summaryrefslogtreecommitdiff
path: root/checkers/variables.py
diff options
context:
space:
mode:
Diffstat (limited to 'checkers/variables.py')
-rw-r--r--checkers/variables.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/checkers/variables.py b/checkers/variables.py
index 90b7fe7..f461319 100644
--- a/checkers/variables.py
+++ b/checkers/variables.py
@@ -507,6 +507,12 @@ builtins. Remember that you should avoid to define new builtins when possible.'
# defined in global or builtin scope
if defframe.root().lookup(name)[1]:
maybee0601 = False
+ else:
+ # check if we have a nonlocal
+ if name in defframe.locals:
+ maybee0601 = not any(isinstance(child, astroid.Nonlocal)
+ and name in child.names
+ for child in defframe.get_children())
if (maybee0601
and stmt.fromlineno <= defstmt.fromlineno
and not is_defined_before(node)