diff options
| author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-12-16 17:16:22 +0100 |
|---|---|---|
| committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-12-16 17:16:22 +0100 |
| commit | b4c1bbdf87abc4b902e30f73f58286bd8d7330da (patch) | |
| tree | 420a53338eb16b815207b97c7db95b4906c1eb0b /checkers/variables.py | |
| parent | bd7048c7ce48d7e624ccffc9f197e70e60d58d81 (diff) | |
| download | pylint-git-b4c1bbdf87abc4b902e30f73f58286bd8d7330da.tar.gz | |
fix W0631 false positive reported by Paul Hachmann
Diffstat (limited to 'checkers/variables.py')
| -rw-r--r-- | checkers/variables.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 7f8ab2bc1..3dadf918c 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -288,9 +288,14 @@ builtins. Remember that you should avoid to define new builtins when possible.' def _loopvar_name(self, node, name): # filter variables according to node's scope + # XXX used to filter parents but don't remember why, and removing this + # fixes a W0631 false positive reportedby Paul Hachmann on 2008/12 on + # python-projects (added to func_use_for_or_listcomp_var test) + #astmts = [stmt for stmt in node.lookup(name)[1] + # if hasattr(stmt, 'ass_type')] and + # not stmt.statement().parent_of(node)] astmts = [stmt for stmt in node.lookup(name)[1] - if hasattr(stmt, 'ass_type') and - not stmt.statement().parent_of(node)] + if hasattr(stmt, 'ass_type')] # filter variables according their respective scope if not astmts or astmts[0].statement().parent_of(node): _astmts = [] |
