-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
typing_extension.Self
infers the wrong type from __new__
#4668
Comments
I'm not able to repro the problem you're seeing. Here's the behavior I see: Can you confirm that when you paste the above code into a new editor window in a new project with default pyright settings that you get an error? Perhaps you have an old version of |
Ah, you're using a version of typeshed that is newer than what is bundled with pyright 1.1.294. That's an important detail! I'm able to repro the problem now, so I'll investigate further. |
… is called and is bound to a class that is different from the `cls` argument passed to it. This addresses #4668.
Thanks for the bug report. This will be addressed in the next release. |
This is addressed in pyright 1.1.295, which I just published. It will also be included in a future release of pylance. |
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.
Describe the bug
When using
__new__
directly (example below), the return type is the class itself instead of inferring from the firstclassmethod
param (cls
)To Reproduce
Expected behavior
member
should beActionLevel
notint
Screenshots or Code
VS Code extension or command-line
Both.
npx pyright@1.1.294 .\scripts\stubsabot.py
Additional context
This was first found here: python/typeshed#9694 (comment)
The text was updated successfully, but these errors were encountered: