Commit 2e729e54 authored by David Wilson's avatar David Wilson

importer: fix glaring bug in find_related()

Overwriting 'fullname' variable caused basically nonsensical filtering.
Result was including the module being searched in the list of
dependencies, which was causing ModuleResponder to send it early, which
was causing contexts to start importing the module before preloading of
dependencies had completed.
parent 0dbb1ec0
...@@ -401,7 +401,9 @@ class ModuleFinder(object): ...@@ -401,7 +401,9 @@ class ModuleFinder(object):
if level == -1: if level == -1:
modnames = [modname, '%s.%s' % (fullname, modname)] modnames = [modname, '%s.%s' % (fullname, modname)]
else: else:
modnames = [self.resolve_relpath(fullname, level) + modname] modnames = [
'%s.%s' % (self.resolve_relpath(fullname, level), modname)
]
maybe_names.extend(modnames) maybe_names.extend(modnames)
maybe_names.extend( maybe_names.extend(
...@@ -425,11 +427,12 @@ class ModuleFinder(object): ...@@ -425,11 +427,12 @@ class ModuleFinder(object):
found = set() found = set()
while stack: while stack:
fullname = stack.pop(0) name = stack.pop(0)
fullnames = self.find_related_imports(fullname) names = self.find_related_imports(name)
stack.extend(set(fullnames).difference(found, stack, [fullname])) stack.extend(set(names).difference(found, stack))
found.update(fullnames) found.update(names)
found.discard(fullname)
return sorted(found) return sorted(found)
......
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