Skip to content

Commit a5f3f7a

Browse files
author
Guido van Rossum
committed
Always process modules/packages given with -m/-p
Fixes #2779
1 parent d3e3914 commit a5f3f7a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎mypy/build.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,7 @@ def __init__(self,
11141114
caller_state: 'State' = None,
11151115
caller_line: int = 0,
11161116
ancestor_for: 'State' = None,
1117+
root_source: bool = False,
11171118
) -> None:
11181119
assert id or path or source is not None, "Neither id, path nor source given"
11191120
self.manager = manager
@@ -1148,7 +1149,7 @@ def __init__(self,
11481149
# - skip -> don't analyze, make the type Any
11491150
follow_imports = self.options.follow_imports
11501151
if (follow_imports != 'normal'
1151-
and caller_state != None # Honor top-level modules
1152+
and not root_source # Honor top-level modules
11521153
and path.endswith('.py') # Stubs are always normal
11531154
and id != 'builtins' # Builtins is always normal
11541155
and not (caller_state and
@@ -1600,7 +1601,8 @@ def load_graph(sources: List[BuildSource], manager: BuildManager) -> Graph:
16001601
# Seed the graph with the initial root sources.
16011602
for bs in sources:
16021603
try:
1603-
st = State(id=bs.module, path=bs.path, source=bs.text, manager=manager)
1604+
st = State(id=bs.module, path=bs.path, source=bs.text, manager=manager,
1605+
root_source=True)
16041606
except ModuleNotFound:
16051607
continue
16061608
if st.id in graph:

0 commit comments

Comments
 (0)