Skip to content

Conversation

@brycepg
Copy link
Contributor

@brycepg brycepg commented Jun 21, 2018

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 #565

Copy link
Contributor

@PCManticore PCManticore left a 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;
Copy link
Contributor

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?

Copy link
Contributor Author

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

super(Const, self).__init__(lineno, col_offset, parent)

def __getattr__(self, name):
# This is needed becuase of Proxy's __getattr__ method.
Copy link
Contributor

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__
Copy link
Contributor

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
@brycepg
Copy link
Contributor Author

brycepg commented Jun 24, 2018

Thanks for the review

I'll take a look at #205

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants