Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3201,6 +3201,10 @@ def visit_import_all(self, i: ImportAll) -> None:
# namespace is incomplete.
self.mark_incomplete("*", i)
for name, node in m.names.items():
if node.no_serialize:
# This is either internal or generated symbol, skip it to avoid problems
# like accidental name conflicts or invalid cross-references.
continue
fullname = i_id + "." + name
self.set_future_import_flags(fullname)
# if '__all__' exists, all nodes not included have had module_public set to
Expand Down
30 changes: 30 additions & 0 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -7596,3 +7596,33 @@ X = 0
tmp/a.py:6: error: "object" has no attribute "dtypes"
[out2]
tmp/a.py:2: error: "object" has no attribute "dtypes"

[case testStarImportCycleRedefinition]
import m

[file m.py]
import a

[file m.py.2]
import a
reveal_type(a.C)

[file a/__init__.py]
from a.b import *
from a.c import *
x = 1

[file a/b.py]
from other import C
from a.c import y
class C: ... # type: ignore

[file a/c.py]
from other import C
from a import x
y = 1

[file other.py]
class C: ...
[out2]
tmp/m.py:2: note: Revealed type is "def () -> other.C"