You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be accepted. This construct would be expected to undermine type checking, but not to be rejected outright (or for a different reason).
Actual Behavior
main.py:14: error: Argument 2 to "replace" of "X" has incompatible type "**dict[str, int]"; expected "str" [arg-type]
main.py:14: error: Argument 2 to "replace" of "X" has incompatible type "**dict[str, int]"; expected "None" [arg-type]
Found 2 errors in 1 file (checked 1 source file)
Note that the error messages are even contradicting each other.
Your Environment
Mypy version used: mypy 1.16.0 (compiled: yes)
Mypy command-line flags: None.
Mypy configuration options from mypy.ini (and other config files): None created.
Python version used: Python 3.12.7
Reloaded reports
#19193 might be related, but it is different enough to probably be a different issue, that just happens to affect the same function.
The text was updated successfully, but these errors were encountered:
Bug Report
When using
dataclasses.replace
with**dict
syntax, the argument is compared against all fields, producing spurious errors.To Reproduce
See also https://mypy-play.net/?mypy=master&python=3.12&gist=5f9e333caa33da7a378c572b253bd973
Expected Behavior
It should be accepted. This construct would be expected to undermine type checking, but not to be rejected outright (or for a different reason).
Actual Behavior
Note that the error messages are even contradicting each other.
Your Environment
mypy 1.16.0 (compiled: yes)
mypy.ini
(and other config files): None created.Python 3.12.7
Reloaded reports
#19193 might be related, but it is different enough to probably be a different issue, that just happens to affect the same function.
The text was updated successfully, but these errors were encountered: