Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-23 00:39:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-23 00:39:48 +0300
commit54343b79e67f8baf93903fbbbaccdf32ebf04560 (patch)
tree94f7258f8880450c1e54c8d9b6fe014b228b12d3 /source
parent2811707b927acea0223080eea59346e8e3fe2947 (diff)
remove reload() from builtins since python3 no longer uses this.
use imp.reload now. Should use import hooks but for now replace imp.reload with our own reload as the builtin reload was replaced before.
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/intern/bpy_interface.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 7b31f77a0c9..2c615a52860 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -252,11 +252,24 @@ void BPY_start_python( int argc, char **argv )
{ /* our own import and reload functions */
PyObject *item;
+ PyObject *mod;
//PyObject *m = PyImport_AddModule("__builtin__");
//PyObject *d = PyModule_GetDict(m);
PyObject *d = PyEval_GetBuiltins( );
- PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+// PyDict_SetItemString(d, "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
PyDict_SetItemString(d, "__import__", item=PyCFunction_New(&bpy_import_meth, NULL)); Py_DECREF(item);
+
+ /* move reload here
+ * XXX, use import hooks */
+ mod= PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
+ if(mod) {
+ PyDict_SetItemString(PyModule_GetDict(mod), "reload", item=PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+ Py_DECREF(mod);
+ }
+ else {
+ BKE_assert(!"unable to load 'imp' module.");
+ }
+
}
pyrna_alloc_types();