diff --git a/src/Mod/Assembly/App/AppAssembly.cpp b/src/Mod/Assembly/App/AppAssembly.cpp index 89292fd4a5..27a1b7f13a 100644 --- a/src/Mod/Assembly/App/AppAssembly.cpp +++ b/src/Mod/Assembly/App/AppAssembly.cpp @@ -57,7 +57,16 @@ 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 ed223f8c35..b671bb18fb 100644 --- a/src/Mod/Assembly/Gui/AppAssemblyGui.cpp +++ b/src/Mod/Assembly/Gui/AppAssemblyGui.cpp @@ -68,7 +68,16 @@ 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