diff options
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index de006ba..9c34590 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -391,10 +391,12 @@ 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: # Aug AssName - self.add_message('E0602', args=name, node=node) - else: + 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: + self.add_message('E0602', 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 |