fixed multi level import issue, includes parts of a patch by Lubos Trilety <ltrilety@redhat.com>

This commit is contained in:
David Halter
2013-07-28 23:14:24 +02:00
parent b681c5c90d
commit cdba4ef3e1
3 changed files with 16 additions and 1 deletions

View File

@@ -13,7 +13,8 @@ Aldo Stracquadanio (@Astrac)
Jean-Louis Fuchs (@ganwell)
tek (@tek)
Yasha Borevich (@jjay)
Aaron Griffin
Aaron Griffin <aaronmgriffin@gmail.com>
andviro (@andviro)
Mike Gilbert (@floppym)
Aaron Meurer (@asmeurer)
Lubos Trilety <ltrilety@redhat.com>

View File

@@ -376,6 +376,9 @@ def find_name(scope, name_str, position=None, search_global=False,
result.append(par)
else:
# TODO multi-level import non-breakable
if isinstance(par, pr.Import) and len(par.namespace) > 1:
no_break_scope = True
result.append(par)
return result, no_break_scope

View File

@@ -56,6 +56,17 @@ def scope_nested():
#? set
import_tree.random.a
def scope_nested2():
"""Multiple modules should be indexable, if imported"""
import import_tree.mod1
import import_tree.pkg
#? ['mod1']
import_tree.mod1
#? ['pkg']
import_tree.pkg
#? []
import_tree.rename1
# -----------------
# std lib modules
# -----------------