diff --git a/src/Mod/Assembly/App/AppAssembly.cpp b/src/Mod/Assembly/App/AppAssembly.cpp index 5a8bd4a9d4..15703cc430 100644 --- a/src/Mod/Assembly/App/AppAssembly.cpp +++ b/src/Mod/Assembly/App/AppAssembly.cpp @@ -57,16 +57,12 @@ void AssemblyExport initAssembly() PyErr_SetString(PyExc_ImportError, e.what()); return; } -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef AssemblyAPIDef = { PyModuleDef_HEAD_INIT, "Assembly", module_Assembly_doc, -1, Assembly_methods, NULL, NULL, NULL, NULL }; PyModule_Create(&AssemblyAPIDef); -#else - Py_InitModule3("Assembly", Assembly_methods, module_Assembly_doc); /* mod name, table ptr */ -#endif Base::Console().Log("Loading Assembly module... done\n"); diff --git a/src/Mod/Assembly/Gui/AppAssemblyGui.cpp b/src/Mod/Assembly/Gui/AppAssemblyGui.cpp index b671bb18fb..1ff44d567d 100644 --- a/src/Mod/Assembly/Gui/AppAssemblyGui.cpp +++ b/src/Mod/Assembly/Gui/AppAssemblyGui.cpp @@ -68,16 +68,12 @@ void AssemblyGuiExport initAssemblyGui() return; } -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef AssemblyGuiAPIDef = { PyModuleDef_HEAD_INIT, "AssemblyGui", 0, -1, AssemblyGui_Import_methods, NULL, NULL, NULL, NULL }; PyModule_Create(&AssemblyGuiAPIDef); -#else - (void) Py_InitModule("AssemblyGui", AssemblyGui_Import_methods); /* mod name, table ptr */ -#endif Base::Console().Log("Loading GUI of Assembly module... done\n"); // directly load the module for usage in commands diff --git a/src/Mod/JtReader/App/AppJtReader.cpp b/src/Mod/JtReader/App/AppJtReader.cpp index 1d7390638c..bd621e5d12 100644 --- a/src/Mod/JtReader/App/AppJtReader.cpp +++ b/src/Mod/JtReader/App/AppJtReader.cpp @@ -37,16 +37,12 @@ extern struct PyMethodDef JtReader_methods[]; extern "C" { void AppJtReaderExport initJtReader() { -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef JtReaderAPIDef = { PyModuleDef_HEAD_INIT, "JtReader", 0, -1, JtReader_methods, NULL, NULL, NULL, NULL }; PyModule_Create(&JtReaderAPIDef); -#else - (void) Py_InitModule("JtReader", JtReader_methods); /* mod name, table ptr */ -#endif // load dependent module Base::Interpreter().loadModule("Mesh"); diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index f027c61247..13fd564532 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -314,19 +314,7 @@ PyTypeObject @self.export.Name@::Type = { /* --- Functions to access object as input/output buffer ---------*/ nullptr, /* tp_as_buffer */ /* --- Flags to define presence of optional/expanded features */ -#if PY_MAJOR_VERSION >= 3 Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */ -#else -+ if (self.export.RichCompare and self.export.NumberProtocol): - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_RICHCOMPARE|Py_TPFLAGS_CHECKTYPES, /*tp_flags */ -= elif (self.export.RichCompare): - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_RICHCOMPARE, /*tp_flags */ -= elif (self.export.NumberProtocol): - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES, /*tp_flags */ -= else: - Py_TPFLAGS_DEFAULT, /*tp_flags */ -- -#endif "@self.export.Documentation.UserDocu.replace('\\n','\\\\n\\"\\n \\"')@", /*tp_doc */ nullptr, /*tp_traverse */ nullptr, /*tp_clear */