Commit 0284b614 authored by Robert Bradshaw's avatar Robert Bradshaw

Allow cimport to follow import.

parent 8fdfd5f9
......@@ -1230,6 +1230,9 @@ class ModuleScope(Scope):
self.add_imported_module(m)
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:
self.entries[name] = entry
else:
......
......@@ -15,7 +15,13 @@ print my_vector.no_such_attribute
from libcpp cimport 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"""
5:12: cimported module has no attribute 'no_such_attribute'
......
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