-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
mypy still gives an attr-defined error in dead code when importing platform-specific attributes from modules.
To Reproduce
import sys
if sys.platform != "win32":
assert False
from ctypes import windllCheck 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
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong