Commit 90354468 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

--HG--
extra : transplant_source : %DF7%9D%BC%D2%07%B6%92v5N%7E%D2%3B%9AJ%95d_%B3
parent f0674993
...@@ -9450,7 +9450,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { ...@@ -9450,7 +9450,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;
...@@ -9461,9 +9462,10 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { ...@@ -9461,9 +9462,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