Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Handle type[TypeVar] (fixes #14755)#14756

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@sterliakov
Copy link
Collaborator

Fixes#14755.

This case is already covered bycheck-classes.test::testTypeUsingTypeCClassMethodFromTypeVarUnionBound, now we just remove from it errors that shouldn't be reported.

@github-actions
Copy link
Contributor

Diff frommypy_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.Selfurllib3 (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

@sterliakov
Copy link
CollaboratorAuthor

sterliakov commentedFeb 22, 2023
edited
Loading

The changes seem legit:

  • steap/app.py: I don't fully understand, there is no error for that line, why it used to be a note there?
  • steam/chat.py: there was a case ofA.__new__(A), whereA is some class - correct, was a bug, becauseA was defined by TypeVar with union upper bound (here)
  • urllib3: the error was simply not reported before (see addedelse branch: before this PR it was possible to fall throughcontext.has_no_attr without emitting error message) -here.

Copy link
Collaborator

@hauntsaninjahauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

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

@hauntsaninjahauntsaninja merged commit9cb4872 intopython:masterMar 15, 2023
@hauntsaninja
Copy link
Collaborator

Thank you!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@hauntsaninjahauntsaninjahauntsaninja approved these changes

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

type[TypeVar] not checked properly with upper bound

2 participants

@sterliakov@hauntsaninja

[8]ページ先頭

©2009-2025 Movatter.jp