-
-
Notifications
You must be signed in to change notification settings - Fork 308
Prevent Const copy resulting in recursion #567
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
Conversation
PCManticore
left a comment
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.
Outside of the TODO removal, this looks good, thanks for tackling it!
|
|
||
| _astroid_bootstrapping() | ||
|
|
||
| # TODO : find a nicer way to handle this situation; |
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.
Why was this TODO removed, is this the same bug?
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.
I thought so because of the semicolon referencing the recursion issue on the following line
astroid/node_classes.py
Outdated
| super(Const, self).__init__(lineno, col_offset, parent) | ||
|
|
||
| def __getattr__(self, name): | ||
| # This is needed becuase of Proxy's __getattr__ method. |
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.
Typo here for because
| Note: | ||
| Subclasses of this object will need a custom __getattr__ |
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.
I wonder if we should try #205 to get rid of this Proxy implementation instead.
Calling object.__new__ on a Const node would result in infinite recursion Fix infinite recursion by explicitly raising AttributeError if __getattr__ is called for value See https://nedbatchelder.com/blog/201010/surprising_getattr_recursion.html for more details Close pylint-dev#565
|
Thanks for the review I'll take a look at #205 |
Calling
object.__new__on a Const node would result in infinite recursionFix infinite recursion by explicitly raising AttributeError if
__getattr__is called for valueSee https://nedbatchelder.com/blog/201010/surprising_getattr_recursion.html
for more details
Close #565