mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-10-25 08:43:17 -06:00
avoid using internal functions from Python C API
This commit is contained in:
1 parent
a3b19e585d
commit
97779f15e6
1 file changed
+4
-3
@@ -1614,12 +1614,13 @@ PGF_embed(PGFObject* self, PyObject *modname)
|
||||
py_embedding->dict = PyDict_New();
|
||||
} else {
|
||||
py_embedding->dict = PyModule_GetDict(module);
|
||||
if (py_embedding->dict == NULL)
|
||||
return NULL;
|
||||
Py_INCREF(py_embedding->dict);
|
||||
}
|
||||
|
||||
if (_PyImport_SetModule(modname, (PyObject*) py_embedding) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject *modules = PyImport_GetModuleDict();
|
||||
PyDict_SetItem(modules, modname, (PyObject*) py_embedding);
|
||||
|
||||
return (PyObject*) py_embedding;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user