-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixing signature for Mapping.get's default parameter #2810
Conversation
Test failure seems benign (just changed the signature that was being surfaced in a error message). How does one update the mypy tests to match a new typeshed version? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems reasonable to me. I'd like to wait for feedback from the mypy team, though.
LGTM. The process for such situations is to merge here despite the failure, then make a PR to mypy, that syncs the typeshed commit and updates the error message. After PR is merged in mypy, things will be green here again. It is better minimize time between merging here and making the mypy PR. |
Looks good to me too. Could you make a PR to mypy to make the corresponding change there? I'll then be able to merge both. |
How do I sync the typeshed commit in my mypy pr if this one isn't merged yet? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC @JelleZijlstra will do the merge dance?
It looks like we will need to revert this PR. This causes significant troubles in real code. Consider this example: m: Mapping[str, List[str]]
x = m.get('x', [])
reveal_type(x) This used to produce The old signature provided type context for inference of the default argument, and was not wrong in any sense. I will make a PR to revert this now. |
This reverts commit 3f83195.
This better reflects the semantics of the method, (i.e. returning either the value type or the default type), synchronizes it with werkzeug.datastructures.TypeConversionDict and werkzeug.datastructures.Headers, and stops making pyre think that _T is free when default is a _VT_co