summaryrefslogtreecommitdiff
path: root/scoped_nodes.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2014-10-16 09:16:03 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2014-10-16 09:16:03 +0300
commitc4f0d9dd4f55887a8420b8085feee55026875bb5 (patch)
treec5f078d6a7c374178ae839b958794991c674d1d4 /scoped_nodes.py
parentc0998ff1213b51dd112f58bf226ad679fd358af2 (diff)
downloadastroid-git-c4f0d9dd4f55887a8420b8085feee55026875bb5.tar.gz
Fix an infinite loop with decorator call chain inference, where the decorator returns itself. Closes issue #50.
Diffstat (limited to 'scoped_nodes.py')
-rw-r--r--scoped_nodes.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/scoped_nodes.py b/scoped_nodes.py
index eb60298f..08fc67bf 100644
--- a/scoped_nodes.py
+++ b/scoped_nodes.py
@@ -499,6 +499,10 @@ def _infer_decorator_callchain(node):
# because there's no flow to reason when the return
# is what we are looking for, a static or a class method.
result = current.infer_call_result(current.parent).next()
+ if current is result:
+ # This will lead to an infinite loop, where a decorator
+ # returns itself.
+ return
except (StopIteration, InferenceError):
return
if isinstance(result, (Function, CallFunc)):