Bug Report
mypy still gives an attr-defined error in dead code when importing platform-specific attributes from modules.
To Reproduce
importsysifsys.platform!="win32":
assertFalsefromctypesimportwindll
Check it on any OS other than Windows.
Expected Behavior
No errors. This is valid code since it has the platform-specific guard.
Actual Behavior
$ uvx mypy example.py example.py:6: error: Module "ctypes" has no attribute "windll" [attr-defined]Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: mypy 1.19.0 (compiled: yes)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini (and other config files): none - Python version used: 3.12
Bug Report
mypystill gives anattr-definederror in dead code when importing platform-specific attributes from modules.To Reproduce
Check it on any OS other than Windows.
Expected Behavior
No errors. This is valid code since it has the platform-specific guard.
Actual Behavior
Your Environment
mypy.ini(and other config files): none