-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wronggood-second-issuetopic-finalPEP 591PEP 591topic-match-statementPython 3.10's match statementPython 3.10's match statement
Description
Bug Report
When matching patterns assignment can override Final variables, and mypy
does not report an error.
To Reproduce
from typing import Final
FOO: Final = 8
a = 10
match a:
case FOO:
pass
print(FOO) # FOO is reassigned, prints 10
Expected Behavior
For MyPy to report an error because FOO
is final and this assignment should be disallowed.
Actual Behavior
No error is reported
Your Environment
Tested on MacOS and Ubuntu (wsl).
- Mypy version used: 1.17.0
- Mypy command-line flags: none
- Python version used: 3.11.3
sterliakov
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wronggood-second-issuetopic-finalPEP 591PEP 591topic-match-statementPython 3.10's match statementPython 3.10's match statement