-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Incorrect "redundant cast" between total and partial dicts #12200
New issue
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
Comments
Apologies if this is a duplicate! I searched but the existing issues I found seemed like they were about other redundant cast bugs. |
Note that it should be a redundant cast under #12142... I'm not sure if it will be accepted though. |
We recently ran in a similar issue with boto stubs where strict output data from boto calls could not be re-used as input data for other boto calls where missing keys are allowed. youtype/mypy_boto3_builder#208 The fix was apparently to remove the Output types and only use the types with Is there are better alternative than using |
It appears this was fixed in mypy 0.981. |
Fixed in #13311 |
Bug Report
Casting a total dict to an equivalent non-total dict incorrectly warns that the cast is redundant.
To Reproduce
Expected Behavior
No mypy errors/warnings
Actual Behavior
The mypy docs state "a total TypedDict is not valid when a partial one is expected", so this seems incorrect, and indeed if I remove the cast, I get:
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: