summaryrefslogtreecommitdiff
path: root/checkers/classes.py
diff options
context:
space:
mode:
authorMaarten ter Huurne <maarten@treewalker.org>2010-03-02 01:27:44 +0100
committerMaarten ter Huurne <maarten@treewalker.org>2010-03-02 01:27:44 +0100
commit65cb8eb227ecdacea456950032bcd26b48b555a6 (patch)
tree571f64e77c29d0cf09e05da5dd0a80cc97300fcc /checkers/classes.py
parente10e4a4c304dd37af97ff364a6148492d2fa6cbe (diff)
downloadpylint-65cb8eb227ecdacea456950032bcd26b48b555a6.tar.gz
Fix and test case for W0233 false positive: if the same superclass
constructor was called twice, the second time was reported as a call to a non-existing superclass constructor.
Diffstat (limited to 'checkers/classes.py')
-rw-r--r--checkers/classes.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/checkers/classes.py b/checkers/classes.py
index eb306d5..0609d17 100644
--- a/checkers/classes.py
+++ b/checkers/classes.py
@@ -433,6 +433,7 @@ instance attributes.'}
"""
klass_node = node.parent.frame()
to_call = _ancestors_to_call(klass_node)
+ not_called_yet = dict(to_call)
for stmt in node.nodes_of_class(astng.CallFunc):
expr = stmt.func
if not isinstance(expr, astng.Getattr) \
@@ -448,12 +449,13 @@ instance attributes.'}
if klass is YES:
continue
try:
- del to_call[klass]
+ del not_called_yet[klass]
except KeyError:
- self.add_message('W0233', node=expr, args=klass.name)
+ if klass not in to_call:
+ self.add_message('W0233', node=expr, args=klass.name)
except astng.InferenceError:
continue
- for klass in to_call.keys():
+ for klass in not_called_yet.keys():
if klass.name == 'object':
continue
self.add_message('W0231', args=klass.name, node=node)