Commit 9baaa6bf authored by Craig Citro's avatar Craig Citro

Fix for #505 mistakenly treated things like "cimport cythontools" as a cython import.

parent 1565d164
...@@ -395,7 +395,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -395,7 +395,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
return node return node
def visit_FromCImportStatNode(self, node): def visit_FromCImportStatNode(self, node):
if node.module_name.startswith(u"cython"): if (node.module_name == u"cython") or \
node.module_name.startswith(u"cython."):
submodule = (node.module_name + u".")[7:] submodule = (node.module_name + u".")[7:]
newimp = [] newimp = []
for pos, name, as_name, kind in node.imported_names: for pos, name, as_name, kind in node.imported_names:
...@@ -415,7 +416,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -415,7 +416,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
return node return node
def visit_FromImportStatNode(self, node): def visit_FromImportStatNode(self, node):
if node.module.module_name.value.startswith(u"cython"): if (node.module.module_name.value == u"cython") or \
node.module.module_name.value.startswith(u"cython."):
submodule = (node.module.module_name.value + u".")[7:] submodule = (node.module.module_name.value + u".")[7:]
newimp = [] newimp = []
for name, name_node in node.items: for name, name_node in node.items:
......
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