diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-06 17:29:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-06 17:29:00 +0400 |
commit | 41bfb62b0fd72ebd0f3031a261711a00d5e8221b (patch) | |
tree | a0a54292fdfa2f34954eaa6d2bd4ee52b50772b1 /source/blender | |
parent | 48f968edc264f914c071784571e6d8b6dc9aeab4 (diff) |
was trying to make py import follow pythons own code more but broke py32 compat. this should fix
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/generic/bpy_internal_import.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 39a75fc6647..ad97ceb68d4 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -257,8 +257,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { PyObject *exception, *err, *tb; - //char *name; - PyObject *name; + char *name; int found = 0; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; int level = 0; /* relative imports */ @@ -267,14 +266,14 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject //PyObject_Print(args, stderr, 0); static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kw, "U|OOOi:bpy_import_meth", (char **)kwlist, + if (!PyArg_ParseTupleAndKeywords(args, kw, "s|OOOi:bpy_import_meth", (char **)kwlist, &name, &globals, &locals, &fromlist, &level)) { return NULL; } /* import existing builtin modules or modules that have been imported already */ - newmodule = PyImport_ImportModuleLevelObject(name, globals, locals, fromlist, level); + newmodule = PyImport_ImportModuleLevel(name, globals, locals, fromlist, level); if (newmodule) return newmodule; @@ -282,7 +281,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */ /* importing from existing modules failed, see if we have this module as blender text */ - newmodule = bpy_text_import_name(_PyUnicode_AsString(name), &found); + newmodule = bpy_text_import_name(name, &found); if (newmodule) { /* found module as blender text, ignore above exception */ PyErr_Clear(); |