Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
cb40a3e6
Commit
cb40a3e6
authored
Apr 16, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work around Py3k importlib changes: old-style rel+abs imports are no longer supported
parent
d6c9c5f7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+25
-6
No files found.
Cython/Compiler/ExprNodes.py
View file @
cb40a3e6
...
@@ -9572,6 +9572,24 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
...
@@ -9572,6 +9572,24 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
goto bad;
goto bad;
#if PY_VERSION_HEX >= 0x02050000
#if PY_VERSION_HEX >= 0x02050000
{
{
#if PY_VERSION_HEX >= 0x03030000
if (level == -1) {
/* try relative import first */
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
level = 0; /* try absolute import on failure */
}
}
#endif
if (!module) {
PyObject *py_level = PyInt_FromLong(level);
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
if (!py_level)
goto bad;
goto bad;
...
@@ -9579,6 +9597,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
...
@@ -9579,6 +9597,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
name, global_dict, empty_dict, list, py_level, NULL);
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
Py_DECREF(py_level);
}
}
}
#else
#else
if (level>0) {
if (level>0) {
PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment