Handle type[TypeVar] (fixes #14755)#14756
Merged
hauntsaninja merged 1 commit intopython:masterfrom Mar 15, 2023
Merged
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: steam.py (https://github.com/Gobot1234/steam.py)
- steam/app.py:129: note: Maybe you forgot to use "await"?
- steam/chat.py:401: error: No overload variant of "__new__" of "type" matches argument type "Type[ChatMessageT]" [call-overload]
- steam/chat.py:401: note: Possible overload variants:
- steam/chat.py:401: note: def __new__(cls: Type[type], object, /) -> type
- steam/chat.py:401: note: def [_typeshed.Self] __new__(cls: Type[_typeshed.Self], str, Tuple[type, ...], Dict[str, Any], /, **kwds: Any) -> _typeshed.Self
urllib3 (https://github.com/urllib3/urllib3)
+ test/__init__.py:97: error: Module has no attribute "PROTOCOL_TLS" [attr-defined]
+ test/__init__.py:97: note: Error code "attr-defined" not covered by "type: ignore" comment
|
Collaborator
Author
|
The changes seem legit:
|
hauntsaninja
approved these changes
Feb 26, 2023
Collaborator
hauntsaninja
left a comment
There was a problem hiding this comment.
Thanks, this looks great!
re: steam/app.py, there is an error for that line, it's just that the error existed both before and after this change so it doesn't show up in the diff. Why the note goes away isn't exactly clear to me, I will take a look later
Collaborator
|
Thank you! |
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.
Fixes #14755.
This case is already covered by
check-classes.test::testTypeUsingTypeCClassMethodFromTypeVarUnionBound, now we just remove from it errors that shouldn't be reported.