Closed
Closed
Copy link
Description
Bug Report
Not a big deal, but mypy appears to generate __match_args__
for dataclasses and NamedTuple
s even when running with --python-version
set to 3.9:
from dataclasses import dataclass
from typing import NamedTuple
@dataclass
class One:
bar: int
f: One
reveal_type(f.__match_args__) # Revealed type is "Tuple[Literal['bar']]"
class Two(NamedTuple):
baz: str
g: Two
reveal_type(g.__match_args__) # Revealed type is "Tuple[Literal['baz']]"
Expected Behavior
Mypy should not autogenerate __match_args__
when running with --python-version
set to <3.10, as pattern-matching is new in 3.10.
Your Environment
- Mypy version used:
0.950+dev.a33d2353a81d075850a487f3913720037f2473aa (compiled: no)
- Mypy command-line flags:
--python-version 3.9
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.10
- Operating system and version: Windows
Metadata
Metadata
Assignees
Labels
mypy got something wrongmypy got something wrongPython 3.10's match statementPython 3.10's match statementmypy doesn't model runtime semantics correctlymypy doesn't model runtime semantics correctly