We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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):
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.ini
The text was updated successfully, but these errors were encountered:
Possibly related (but different) to #15748
Sorry, something went wrong.
kw_only
__match_args__
Do not add kw_only dataclass fields to __match_args__ (#18892)
749f258
In runtime python does not add fields that have `kw_only` marker: - https://github.com/python/cpython/blob/895d983b5c9716aaaab34d14d278084b9b6730d8/Lib/dataclasses.py#L1174-L1177 - https://github.com/python/cpython/blob/895d983b5c9716aaaab34d14d278084b9b6730d8/Lib/dataclasses.py#L411-L417 See: ```python >>> import dataclasses >>> @dataclasses.dataclass(kw_only=True) ... class A: ... a: int ... >>> print(A.__match_args__) () ``` Closes #18863
sobolevn
Successfully merging a pull request may close this issue.
Bug Report
Generating and then testing stubs on a dataclass with frozen keyword arguments fails.
To Reproduce
Then generate a stub, and run stubtest. The generated stub is (indentical to the above):
Expected Behavior
stubtest passes
Actual Behavior
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: