summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 07:06:25 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 07:06:25 (GMT)
commit5c9aad6043724148f2159191cf14d751c6ec44d2 (patch)
tree041117e5e5afb5d32ffdcd98eedff0dc2c4c30f3 /Lib
parent3f76b7e6e465a7109f78d499996246d8de26f6a8 (diff)
downloadcpython-5c9aad6043724148f2159191cf14d751c6ec44d2.zip
cpython-5c9aad6043724148f2159191cf14d751c6ec44d2.tar.gz
cpython-5c9aad6043724148f2159191cf14d751c6ec44d2.tar.bz2
Only treat an AugAssign as def if its the target is a Name.
Fixes last bug found with test_scope.py.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/compiler/symbols.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/compiler/symbols.py b/Lib/compiler/symbols.py
index cde937b..6d834e0 100644
--- a/Lib/compiler/symbols.py
+++ b/Lib/compiler/symbols.py
@@ -299,9 +299,11 @@ class SymbolVisitor:
scope.add_def(node.name)
def visitAugAssign(self, node, scope):
- # basically, the node is referenced and defined by the same expr
+ # If the LHS is a name, then this counts as assignment.
+ # Otherwise, it's just use.
self.visit(node.node, scope)
- self.visit(node.node, scope, 1)
+ if isinstance(node.node, ast.Name):
+ self.visit(node.node, scope, 1) # XXX worry about this
self.visit(node.expr, scope)
def visitAssign(self, node, scope):