py/rna update, reload works again.

- fix for reload (f8) crashing, missing incref when creating the script namespace.
- store the module names rather then the modules for reloading incase the modules get out of date.
This commit is contained in:
2010-08-03 03:53:36 +00:00
parent c475f38239
commit 233df907d0
4 changed files with 40 additions and 50 deletions

View File

@@ -160,11 +160,10 @@ static PyObject *CreateGlobalDictionary(bContext *C, const char *filename)
PyObject *mod_main= PyModule_New("__main__");
PyDict_SetItemString(interp->modules, "__main__", mod_main);
Py_DECREF(mod_main); /* sys.modules owns now */
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
PyModule_AddStringConstant(mod_main, "__name__", "__main__");
PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */
PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
Py_INCREF(interp->builtins); /* AddObject steals a reference */
return PyModule_GetDict(mod_main);
}