diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-16 09:16:03 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2014-10-16 09:16:03 +0300 |
commit | c4f0d9dd4f55887a8420b8085feee55026875bb5 (patch) | |
tree | c5f078d6a7c374178ae839b958794991c674d1d4 /scoped_nodes.py | |
parent | c0998ff1213b51dd112f58bf226ad679fd358af2 (diff) | |
download | astroid-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.py | 4 |
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)): |