diff options
author | Andreas Finkler <3929834+DudeNr33@users.noreply.github.com> | 2023-01-08 12:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-08 12:16:10 +0100 |
commit | 91513a09513c7cc54e78f38999aa5fda4c77625d (patch) | |
tree | d277d2e4c8a93adf0d2f9815c7c676aeea8626bc /pylint/pyreverse | |
parent | 89a20e2ccdb2927ac370f7c6663fc83318988e10 (diff) | |
download | pylint-git-91513a09513c7cc54e78f38999aa5fda4c77625d.tar.gz |
Prevent `pyreverse` crash when processing attributes assigned via tuple unpacking (#8032)
Diffstat (limited to 'pylint/pyreverse')
-rw-r--r-- | pylint/pyreverse/inspector.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py index 8c403ffc6..af97cdb33 100644 --- a/pylint/pyreverse/inspector.py +++ b/pylint/pyreverse/inspector.py @@ -365,7 +365,9 @@ class AbstractAssociationHandler(AssociationHandlerInterface): class AggregationsHandler(AbstractAssociationHandler): def handle(self, node: nodes.AssignAttr, parent: nodes.ClassDef) -> None: - if isinstance(node.parent.value, astroid.node_classes.Name): + if isinstance(node.parent, (nodes.AnnAssign, nodes.Assign)) and isinstance( + node.parent.value, astroid.node_classes.Name + ): current = set(parent.aggregations_type[node.attrname]) parent.aggregations_type[node.attrname] = list( current | utils.infer_node(node) |