summaryrefslogtreecommitdiff
path: root/pyflakes/checker.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/checker.py')
-rw-r--r--pyflakes/checker.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 38f8f73..215bd31 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1140,7 +1140,10 @@ class Checker(object):
# then assume the rebound name is used as a global or within a loop
value.used = self.scope[value.name].used
- self.scope[value.name] = value
+ # don't treat annotations as assignments if there is an existing value
+ # in scope
+ if value.name not in self.scope or not isinstance(value, Annotation):
+ self.scope[value.name] = value
def _unknown_handler(self, node):
# this environment variable configures whether to error on unknown