Commit 2ed50c7f authored by Stefan Behnel's avatar Stefan Behnel

fix "from . cimport xyz" without package or module name in the "from" part

parent e884efb9
......@@ -1121,7 +1121,7 @@ class ModuleScope(Scope):
# merge current absolute module name and relative import name into qualified name
current_module = module_scope.qualified_name.split('.')
base_package = current_module[:-relative_level]
module_name = '.'.join(base_package + module_name.split('.'))
module_name = '.'.join(base_package + (module_name.split('.') if module_name else []))
return module_scope.context.find_module(
module_name, relative_to=None if relative_level == 0 else self.parent_module, pos=pos)
......
......@@ -35,8 +35,10 @@ cdef class test_pxd:
######## pkg/b.pyx ########
from . cimport a
from .a cimport test_pxd
assert a.test_pxd is test_pxd
def test():
cdef test_pxd obj = test_pxd()
......
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