b.py:4: note: Revealed type is "Any"
Success: no issues found in 1 source file
Actual Behavior
b.py:3: error: Variable "a.Bweh" is not valid as a type [valid-type]
x: Bweh = 5
^
b.py:3: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
b.py:4: note: Revealed type is "Bweh?"
Found 1 error in 1 file (checked 1 source file)
Your Environment
Mypy version used: 2.4.0
Mypy command-line flags: --pretty --strict
Mypy configuration options from mypy.ini (and other config files): N/A
I'll look into this. My working hypothesis: during the import cycle b is analyzed while a is still incomplete, so from a import Bweh binds the not-yet-analyzed placeholder Var instead of falling back to a's module-level __getattr__, and the resulting ? type leaks into annotations.
Activity
Madin-H23 commented on Oct 5, 2026
I'll look into this. My working hypothesis: during the import cycle b is analyzed while a is still incomplete, so from a import Bweh binds the not-yet-analyzed placeholder Var instead of falling back to a's module-level __getattr__, and the resulting ? type leaks into annotations.