Fix for #505 mistakenly treated things like "cimport cythontools" as a cython import.
authorCraig Citro <craigcitro@gmail.com>
Wed, 10 Feb 2010 06:01:34 +0000 (22:01 -0800)
committerCraig Citro <craigcitro@gmail.com>
Wed, 10 Feb 2010 06:01:34 +0000 (22:01 -0800)
Cython/Compiler/ParseTreeTransforms.py

index 3dd4847cbfb5a1d194b1b188a1a2f2998db43082..3ac1058893d693946bd2b7c828ad15e7520f30ce 100644 (file)
@@ -395,7 +395,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
         return 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:]
             newimp = []
             for pos, name, as_name, kind in node.imported_names:
@@ -415,7 +416,8 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
         return 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:]
             newimp = []
             for name, name_node in node.items: