summaryrefslogtreecommitdiff
path: root/astroid/inference.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-01-19 00:02:11 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-01-19 00:02:11 +0100
commit931415b9a98ee5c9ed5bfef89c8e0901dd6a3c60 (patch)
tree5099b7f02e597796689ea6fadaa971c3ecfe2f41 /astroid/inference.py
parentb96f9f1e40845dd192877672040eedefea8a28f2 (diff)
downloadastroid-git-931415b9a98ee5c9ed5bfef89c8e0901dd6a3c60.tar.gz
Make sure that Attribute.infer has a protection against StopIterations
Diffstat (limited to 'astroid/inference.py')
-rw-r--r--astroid/inference.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/astroid/inference.py b/astroid/inference.py
index dbcf8a62..16346a77 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -274,7 +274,6 @@ def infer_import_from(self, context=None, asname=True):
nodes.ImportFrom._infer = infer_import_from
-@decorators.raise_if_nothing_inferred
def infer_attribute(self, context=None):
"""infer an Attribute node by using getattr on the associated object"""
for owner in self.expr.infer(context):
@@ -311,8 +310,11 @@ def infer_attribute(self, context=None):
return dict(node=self, context=context)
-nodes.Attribute._infer = decorators.path_wrapper(infer_attribute)
-nodes.AssignAttr.infer_lhs = infer_attribute # # won't work with a path wrapper
+nodes.Attribute._infer = decorators.raise_if_nothing_inferred(
+ decorators.path_wrapper(infer_attribute)
+)
+# won't work with a path wrapper
+nodes.AssignAttr.infer_lhs = decorators.raise_if_nothing_inferred(infer_attribute)
@decorators.raise_if_nothing_inferred