PyAPI: add intern strings

Avoid string conversion on each use.
This commit is contained in:
2017-06-21 12:43:19 +10:00
parent d9bb08f111
commit 5b51dcacbc
4 changed files with 43 additions and 36 deletions

View File

@@ -530,7 +530,8 @@ 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_GetItem(
PyThreadState_GET()->interp->modules, bpy_intern_str___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. */