-
-
Notifications
You must be signed in to change notification settings - Fork 297
Prevent creating Instance
that proxies another Instance
when inferring __new__(cls)
#1682
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
Prevent creating Instance
that proxies another Instance
when inferring __new__(cls)
#1682
Conversation
…rring `__new__(cls)`
Pull Request Test Coverage Report for Build 2602639973
💛 - Coveralls |
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.
LGTM, just a question for my information :)
This is going to be too difficult to backport; bumping to 2.12. |
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.
Last two nits!
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.
Thanks @jacobtylerwalls!
Thanks for the initial digging and the review! ✨ |
There's two issues left in 2.12, including this one that is mergeable, should we even release 2.11.7 ? |
I'd like to get the |
This has created an issue for I'm looking into a solution. |
See #1689. |
Steps
Description
See discussion at pylint-dev/pylint#7109 (comment). When astroid thinks
__new__(cls)
is being called with an instance either due to user error or because of inference ambiguity (e.g. the library code in the OP used anisinstance
guard that astroid doesn't cope with), we now raiseInferenceError
instead of creating a bogus Instance-proxied-to-Instance. Callers then transform this toUninferable
as appropriate. (See #782 for a precedent.)Type of Changes
Related Issue
Refs pylint-dev/pylint#7109