mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-09-17 07:46:00 -06:00
avoid using internal functions from Python C API
This commit is contained in:
@@ -1614,12 +1614,13 @@ PGF_embed(PGFObject* self, PyObject *modname)
|
|||||||
py_embedding->dict = PyDict_New();
|
py_embedding->dict = PyDict_New();
|
||||||
} else {
|
} else {
|
||||||
py_embedding->dict = PyModule_GetDict(module);
|
py_embedding->dict = PyModule_GetDict(module);
|
||||||
|
if (py_embedding->dict == NULL)
|
||||||
|
return NULL;
|
||||||
Py_INCREF(py_embedding->dict);
|
Py_INCREF(py_embedding->dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_PyImport_SetModule(modname, (PyObject*) py_embedding) < 0) {
|
PyObject *modules = PyImport_GetModuleDict();
|
||||||
return NULL;
|
PyDict_SetItem(modules, modname, (PyObject*) py_embedding);
|
||||||
}
|
|
||||||
|
|
||||||
return (PyObject*) py_embedding;
|
return (PyObject*) py_embedding;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user