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
Boxiang Sun
cython
Commits
0284b614
Commit
0284b614
authored
Jun 16, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow cimport to follow import.
parent
8fdfd5f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+3
-0
tests/errors/cimport_attributes.pyx
tests/errors/cimport_attributes.pyx
+7
-1
No files found.
Cython/Compiler/Symtab.py
View file @
0284b614
...
@@ -1230,6 +1230,9 @@ class ModuleScope(Scope):
...
@@ -1230,6 +1230,9 @@ class ModuleScope(Scope):
self
.
add_imported_module
(
m
)
self
.
add_imported_module
(
m
)
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
def
add_imported_entry
(
self
,
name
,
entry
,
pos
):
if
entry
.
is_pyglobal
:
# Allow cimports to follow imports.
entry
.
is_variable
=
True
if
entry
not
in
self
.
entries
:
if
entry
not
in
self
.
entries
:
self
.
entries
[
name
]
=
entry
self
.
entries
[
name
]
=
entry
else
:
else
:
...
...
tests/errors/cimport_attributes.pyx
View file @
0284b614
...
@@ -15,7 +15,13 @@ print my_vector.no_such_attribute
...
@@ -15,7 +15,13 @@ print my_vector.no_such_attribute
from
libcpp
cimport
vector
as
my_vector_with_shadow
from
libcpp
cimport
vector
as
my_vector_with_shadow
from
libcpp
import
vector
as
my_vector_with_shadow
from
libcpp
import
vector
as
my_vector_with_shadow
print
my_vector_with_shadow
.
no_such_attribute
# OK (if such a module existed at runtime)
print
my_vector_with_shadow
.
python_attribute
# OK (if such a module existed at runtime)
# Other ordering
from
libcpp
import
map
as
my_map_with_shadow
from
libcpp
cimport
map
as
my_map_with_shadow
print
my_map_with_shadow
.
python_attribute
# OK (if such a module existed at runtime)
_ERRORS
=
u"""
_ERRORS
=
u"""
5:12: cimported module has no attribute 'no_such_attribute'
5:12: cimported module has no attribute 'no_such_attribute'
...
...
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