Commit e04894e2 authored by Stefan Behnel's avatar Stefan Behnel

another fix for old-style imports in Py3.3: only try relative imports from within a package

parent cb40a3e6
...@@ -9574,7 +9574,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { ...@@ -9574,7 +9574,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
{ {
#if PY_VERSION_HEX >= 0x03030000 #if PY_VERSION_HEX >= 0x03030000
if (level == -1) { if (level == -1) {
/* try relative import first */ if (strchr(__Pyx_MODULE_NAME, '.')) {
/* try package relative import first */
PyObject *py_level = PyInt_FromLong(1); PyObject *py_level = PyInt_FromLong(1);
if (!py_level) if (!py_level)
goto bad; goto bad;
...@@ -9585,9 +9586,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { ...@@ -9585,9 +9586,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
if (!PyErr_ExceptionMatches(PyExc_ImportError)) if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad; goto bad;
PyErr_Clear(); PyErr_Clear();
level = 0; /* try absolute import on failure */
} }
} }
level = 0; /* try absolute import on failure */
}
#endif #endif
if (!module) { if (!module) {
PyObject *py_level = PyInt_FromLong(level); PyObject *py_level = PyInt_FromLong(level);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment