Closed
Description
Bug Report
Generating and then testing stubs on a dataclass with frozen keyword arguments fails.
To Reproduce
import dataclasses
@dataclasses.dataclass(kw_only=True)
class A:
a: int
Then generate a stub, and run stubtest. The generated stub is (indentical to the above):
import dataclasses
@dataclasses.dataclass(kw_only=True)
class A:
a: int
Expected Behavior
stubtest passes
Actual Behavior
% python -m mypy.stubtest test
error: test.A.__match_args__ variable differs from runtime type tuple[()]
Stub: in file /Users/dstansby/software/mpl/matplotlib/test.pyi:-1
tuple[Literal['a']]
Runtime:
()
Found 1 error (checked 1 module)
Your Environment
- Mypy version used: mypy 1.15.0 (compiled: yes)
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: Python 3.12.9