diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2009-03-17 11:31:59 +0100 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2009-03-17 11:31:59 +0100 |
commit | 509c005644f6869d6e7605be81ea0aa7ec5af02a (patch) | |
tree | bc01717afc5d1e7a285d3d63000d2893c59f4a39 /checkers/variables.py | |
parent | 2849673572db661ff01b6628cb756d34efbba305 (diff) | |
download | pylint-509c005644f6869d6e7605be81ea0aa7ec5af02a.tar.gz |
handle Del* and AugAssing situations
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 8bef88c..28a3f5e 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -392,12 +392,11 @@ builtins. Remember that you should avoid to define new builtins when possible.' and stmt.fromlineno <= defstmt.fromlineno and not is_defined_before(node) and not are_exclusive(stmt, defstmt)): - if (stmt is defstmt - and not isinstance(stmt, astng.AugAssign) - and not isinstance(node, astng.DelName)): - self.add_message('E0601', args=name, node=node) - else: + if defstmt is stmt and isinstance(node, (astng.DelName, + astng.AssName)): self.add_message('E0602', args=name, node=node) + else: + self.add_message('E0601', args=name, node=node) if not isinstance(node, astng.AssName): # Aug AssName del to_consume[name] # check it's not a loop variable used outside the loop |