Repository navigation
Turn on ParamSpec semanal by default - #10883
Merged
Merged
Conversation
This PR does not mean mypy supports PEP 612, but it does do enough to unblock python#10862 mypy should now treat Callable[P, T] as Callable[..., T] and the code paths with incomplete support will no longer crash (but will not do what you'd want)
JukkaL
reviewed
Jul 27, 2021
JukkaL
left a comment
Collaborator
There was a problem hiding this comment.
This is an acceptable way to unblock the use of ParamSpec in typeshed, though we need real support for ParamSpec.
Can you also add tests that check that Callable[P, X] is interpreted as Callable[..., X], in a few different contexts (such as in a decorator)?
| skip_unsatisfied: bool | ||
| ) -> Optional[Type]: | ||
| # TODO(shantanu): fix for ParamSpecDef | ||
| if not isinstance(tvar, TypeVarDef): |
Member
There was a problem hiding this comment.
Maybe check specifically for ParamSpecDef so we still hit the assertion if we unexpectedly get some other type. (Same applies to the next change.)
Collaborator
Author
msullivan
approved these changes
Aug 4, 2021
msullivan
left a comment
Collaborator
There was a problem hiding this comment.
I agree with Jelle's suggestion. So make that change if you agree, but otherwise good to go
This comment has been minimized.
This comment has been minimized.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR does not mean mypy supports PEP 612, but along with #10866 does do enough to
unblock #10862
mypy should now treat Callable[P, T] as Callable[..., T] and the
code paths with incomplete support will no longer crash (but will not do
what you'd want)