Skip to content
Snippets Groups Projects
Commit 41bfb62b authored by Campbell Barton's avatar Campbell Barton
Browse files

was trying to make py import follow pythons own code more but broke py32 compat. this should fix

parent 48f968ed
Branches
No related tags found
No related merge requests found
...@@ -257,8 +257,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found) ...@@ -257,8 +257,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw) static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
{ {
PyObject *exception, *err, *tb; PyObject *exception, *err, *tb;
//char *name; char *name;
PyObject *name;
int found = 0; int found = 0;
PyObject *globals = NULL, *locals = NULL, *fromlist = NULL; PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
int level = 0; /* relative imports */ int level = 0; /* relative imports */
...@@ -267,14 +266,14 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject ...@@ -267,14 +266,14 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
//PyObject_Print(args, stderr, 0); //PyObject_Print(args, stderr, 0);
static const char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", NULL}; 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)) &name, &globals, &locals, &fromlist, &level))
{ {
return NULL; return NULL;
} }
/* import existing builtin modules or modules that have been imported already */ /* 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) if (newmodule)
return newmodule; return newmodule;
...@@ -282,7 +281,7 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject ...@@ -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 */ 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 */ /* 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 */ if (newmodule) { /* found module as blender text, ignore above exception */
PyErr_Clear(); PyErr_Clear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment