Skip to content

Commit 46a2fe9

Browse files
hjmjohnsonmrbean-bremen
authored andcommitted
chore: Remove outdated PY_VERSION_HEX conditional branches
This changes simplify the code by removing legacy preprocessor conditionals for Python versions < 2.4. It ensures the consistent use of the `PyMarshal_Write*` API with `Py_MARSHAL_VERSION`.
1 parent d1eb488 commit 46a2fe9

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/PythonQtImporter.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -560,23 +560,11 @@ void PythonQtImport::writeCompiledModule(PyCodeObject *co, const QString& filena
560560
"# can't create %s\n", QStringToPythonConstCharPointer(filename));
561561
return;
562562
}
563-
#if PY_VERSION_HEX < 0x02040000
564-
PyMarshal_WriteLongToFile(PyImport_GetMagicNumber(), fp);
565-
#else
566563
PyMarshal_WriteLongToFile(PyImport_GetMagicNumber(), fp, Py_MARSHAL_VERSION);
567-
#endif
568564
/* First write a 0 for mtime */
569-
#if PY_VERSION_HEX < 0x02040000
570-
PyMarshal_WriteLongToFile(0L, fp);
571-
#else
572565
PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION);
573-
#endif
574566
PyMarshal_WriteLongToFile(sourceSize, fp, Py_MARSHAL_VERSION);
575-
#if PY_VERSION_HEX < 0x02040000
576-
PyMarshal_WriteObjectToFile((PyObject *)co, fp);
577-
#else
578567
PyMarshal_WriteObjectToFile((PyObject *)co, fp, Py_MARSHAL_VERSION);
579-
#endif
580568
if (ferror(fp)) {
581569
if (Py_VerboseFlag)
582570
PySys_WriteStderr("# can't write %s\n", QStringToPythonConstCharPointer(filename));
@@ -587,11 +575,7 @@ void PythonQtImport::writeCompiledModule(PyCodeObject *co, const QString& filena
587575
}
588576
/* Now write the true mtime */
589577
fseek(fp, 4L, 0);
590-
#if PY_VERSION_HEX < 0x02040000
591-
PyMarshal_WriteLongToFile(mtime, fp);
592-
#else
593578
PyMarshal_WriteLongToFile(mtime, fp, Py_MARSHAL_VERSION);
594-
#endif
595579
fflush(fp);
596580
fclose(fp);
597581
if (Py_VerboseFlag) {

0 commit comments

Comments
 (0)