cython-devel

changeset 1940:e5626282016e

Test for ticket #4, from package cimport module, finish fixing ticket.
author Robert Bradshaw <robertwb@math.washington.edu>
date Thu Apr 02 17:39:09 2009 -0700 (4 years ago)
parents c3ed65ed7dd3
children 3c73ec71e74c
files Cython/Compiler/Nodes.py tests/compile/a/__init__.py tests/compile/a/b.pxd tests/compile/cimport_package_module_T4.pyx
line diff
1.1 --- a/Cython/Compiler/Nodes.py Thu Apr 02 21:23:19 2009 -0300 1.2 +++ b/Cython/Compiler/Nodes.py Thu Apr 02 17:39:09 2009 -0700 1.3 @@ -4688,8 +4688,12 @@ 1.4 entry = module_scope.declare_c_class(name, pos = pos, 1.5 module_name = self.module_name) 1.6 else: 1.7 - error(pos, "Name '%s' not declared in module '%s'" 1.8 - % (name, self.module_name)) 1.9 + submodule_scope = env.context.find_module(name, relative_to = module_scope, pos = self.pos) 1.10 + if submodule_scope.parent_module is module_scope: 1.11 + env.declare_module(as_name or name, submodule_scope, self.pos) 1.12 + else: 1.13 + error(pos, "Name '%s' not declared in module '%s'" 1.14 + % (name, self.module_name)) 1.15 1.16 if entry: 1.17 local_name = as_name or name
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tests/compile/a/b.pxd Thu Apr 02 17:39:09 2009 -0700 2.3 @@ -0,0 +1,1 @@ 2.4 +cdef int **foo(void*)
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tests/compile/cimport_package_module_T4.pyx Thu Apr 02 17:39:09 2009 -0700 3.3 @@ -0,0 +1,3 @@ 3.4 +from a cimport b 3.5 + 3.6 +cdef int **t = b.foo(NULL)