diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2014-08-26 22:27:41 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2014-08-26 22:27:41 +0300 |
commit | 0cbbebe7328ae8df3a77e9481059d2ac7f673b0a (patch) | |
tree | f432a6918d5fbc892c09ae4db05041e3795f415d /node_classes.py | |
parent | dbe95f9ad77e523a126d9d4ce8d92e752a738fb7 (diff) | |
download | astroid-git-0cbbebe7328ae8df3a77e9481059d2ac7f673b0a.tar.gz |
Fix a maximum recursion error occured during the inference, where statements with the same name weren't filtered properly. Closes pylint issue #295.
Diffstat (limited to 'node_classes.py')
-rw-r--r-- | node_classes.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/node_classes.py b/node_classes.py index 6d597458..b92fc247 100644 --- a/node_classes.py +++ b/node_classes.py @@ -146,6 +146,20 @@ class LookupMixIn(object): myframe = self.frame().parent.frame() else: myframe = self.frame() + # If the frame of this node is the same as the statement + # of this node, then the node is part of a class or + # a function definition and the frame of this node should be the + # the upper frame, not the frame of the definition. + # For more information why this is important, + # see Pylint issue #295. + # For example, for 'b', the statement is the same + # as the frame / scope: + # + # def test(b=1): + # ... + + if self.statement() is myframe and myframe.parent: + myframe = myframe.parent.frame() if not myframe is frame or self is frame: return stmts mystmt = self.statement() |