Refactor things so goto is working in both directions

This commit is contained in:
Dave Halter
2019-05-05 01:16:52 +02:00
parent df9c9d8dff
commit 4d3a698a12
8 changed files with 95 additions and 28 deletions
+4 -9
View File
@@ -19,18 +19,13 @@ def load_proper_stub_module(evaluator, path, import_names, module_node):
import_names = import_names[:-1]
if import_names is not None:
actual_context_set = evaluator.import_module(import_names)
actual_context_set = evaluator.import_module(import_names, prefer_stubs=False)
if not actual_context_set:
return None
context_set = create_stub_module(
stub = create_stub_module(
evaluator, actual_context_set, module_node, path, import_names
)
for m in context_set:
# Try to load the modules in a way where they are loaded
# correctly as stubs and not as actual modules (which is what
# will happen if this condition isn't True).
if m.stub_context.py__file__() == path:
evaluator.module_cache.add(import_names, context_set)
return m.stub_context
evaluator.stub_module_cache[import_names] = stub
return stub
return None