get rid of private function _PyImport_FixupBuiltin for FreeCAD and FreeCADGui modules

This commit is contained in:
wmayer
2018-09-01 19:57:15 +02:00
parent 8c08635d30
commit b79e1bfee4
3 changed files with 37 additions and 11 deletions

View File

@@ -345,7 +345,8 @@ Application::Application(bool GUIenabled)
#if PY_MAJOR_VERSION >= 3
// if this returns a valid pointer then the 'FreeCADGui' Python module was loaded,
// otherwise the executable was launched
PyObject *module = PyImport_AddModule("FreeCADGui");
PyObject* modules = PyImport_GetModuleDict();
PyObject* module = PyDict_GetItemString(modules, "FreeCADGui");
if (!module) {
static struct PyModuleDef FreeCADGuiModuleDef = {
PyModuleDef_HEAD_INIT,
@@ -354,7 +355,8 @@ Application::Application(bool GUIenabled)
NULL, NULL, NULL, NULL
};
module = PyModule_Create(&FreeCADGuiModuleDef);
_PyImport_FixupBuiltin(module, "FreeCADGui");
PyDict_SetItemString(modules, "FreeCADGui", module);
}
else {
// extend the method list