diff options
| author | Andrew Haigh <hello@nelf.in> | 2021-05-24 19:21:30 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-24 11:21:30 +0200 |
| commit | 53a20335357bbd734d74c3bfe22e3518f74f4d11 (patch) | |
| tree | dc601ff8ad0652fb6a645e54cbcdeced466459b2 /ChangeLog | |
| parent | 2e8417ffc2285e798ccdef86f743abb75958e2c6 (diff) | |
| download | astroid-git-53a20335357bbd734d74c3bfe22e3518f74f4d11.tar.gz | |
Fix inference cycle in getattr when a base is an astroid.Attribute (#934)
* Fix inference cycle in getattr when a base is an astroid.Attribute
Ref #904. `getattr` attempts to find values on `self.ancestors`, which
infers each node listed in `self.bases`. Removing or resetting the
context passed to ancestors allows it to infer the nodes, but opens up
the possibility of cycles through recursive definitions. We should be
able to infer the value of the base node correctly as a `ClassDef`. The
root of this issue stems from the fact that `infer_attribute` attempts
to temporarily set `context.boundnode`, but when unwrapping its changes
it sets the `boundnode` to `None` instead of its previous value, which
loses state and causes the inference of the `Attribute` node to have a
duplicate key: once when looking up the class definition (which should
have `boundnode = None`), and once when inferring the (other) attribute
value (which should not have `boundnode = None`)
* Update changelog
Diffstat (limited to 'ChangeLog')
| -rw-r--r-- | ChangeLog | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -41,6 +41,10 @@ Release Date: TBA Closes #922 +* Fix inference of attributes defined in a base class that is an inner class + + Closes #904 + What's New in astroid 2.5.6? ============================ |
