-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugmypy got something wrongmypy got something wrongpendingIssues that may be closedIssues that may be closed
Description
Bug Report
Mypy report a syntax error what is not in Python3.12+ while --python-version
arg is used.
To Reproduce
This reproduction steps use uv
to make python 3.12 install easier but got same result with standard tools.
➜ cd /tmp
➜ uv venv --python 3.12.6 venv
Using Python 3.12.6
Creating virtual environment at: venv
Activate with: source venv/bin/activate
➜ . venv/bin/activate
(venv) ➜ uv pip install mypy
Resolved 3 packages in 139ms
Installed 3 packages in 22ms
+ mypy==1.11.2
+ mypy-extensions==1.0.0
+ typing-extensions==4.12.2
(venv) ➜ /tmp echo 'import typing
import enum
class MyEnum(enum.Enum):
ONE = "ONE"
def name(self) -> str:
match self:
case self.ONE:
return "1"
case _:
typing.assert_never(self)
' > test.py
(venv) ➜ mypy --python-version=3.12 test.py
test.py:9: error: invalid syntax; you likely need to run mypy using Python 3.12 or newer [syntax]
Found 1 error in 1 file (errors prevented further checking)
Expected Behavior
mypy don't see syntax error at line 9.
Actual Behavior
mypy see syntax error at line 9.
Your Environment
- Mypy version used:
1.11.2
- Mypy command-line flags:
--python-version=3.12
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.12.6
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpendingIssues that may be closedIssues that may be closed