From: Robert Bradshaw Date: Fri, 3 Apr 2009 00:39:09 +0000 (-0700) Subject: Test for ticket #4, from package cimport module, finish fixing ticket. X-Git-Tag: 0.11.1.alpha~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2c748f0e65fa076023d22ba2aa4b7d97f708d249;p=cython.git Test for ticket #4, from package cimport module, finish fixing ticket. --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index f9a8e1a8..8d77c456 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -4688,8 +4688,12 @@ class FromCImportStatNode(StatNode): entry = module_scope.declare_c_class(name, pos = pos, module_name = self.module_name) else: - error(pos, "Name '%s' not declared in module '%s'" - % (name, self.module_name)) + submodule_scope = env.context.find_module(name, relative_to = module_scope, pos = self.pos) + if submodule_scope.parent_module is module_scope: + env.declare_module(as_name or name, submodule_scope, self.pos) + else: + error(pos, "Name '%s' not declared in module '%s'" + % (name, self.module_name)) if entry: local_name = as_name or name diff --git a/tests/compile/a/__init__.py b/tests/compile/a/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/compile/a/b.pxd b/tests/compile/a/b.pxd new file mode 100644 index 00000000..4793acbb --- /dev/null +++ b/tests/compile/a/b.pxd @@ -0,0 +1 @@ +cdef int **foo(void*) diff --git a/tests/compile/cimport_package_module_T4.pyx b/tests/compile/cimport_package_module_T4.pyx new file mode 100644 index 00000000..54367cb6 --- /dev/null +++ b/tests/compile/cimport_package_module_T4.pyx @@ -0,0 +1,3 @@ +from a cimport b + +cdef int **t = b.foo(NULL)