Cleanup: use PyImport_GetModuleDict

Replace direct access using PyThreadState_GET
This commit is contained in:
2018-09-13 17:06:07 +10:00
parent c062d360ca
commit 44f719b632
7 changed files with 10 additions and 9 deletions

View File

@@ -537,7 +537,7 @@ static bool python_script_exec(
if (py_dict) {
#ifdef PYMODULE_CLEAR_WORKAROUND
PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
PyObject *dict_back = mmod->md_dict;
/* freeing the module will clear the namespace,
* gives problems running classes defined in this namespace being used later. */