summaryrefslogtreecommitdiff
path: root/Lib/compiler
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 07:06:25 +0000
committerJeremy Hylton <jeremy@alum.mit.edu>2001-04-12 07:06:25 +0000
commit6989831828e780f636676b583cffed02beb74d5c (patch)
tree0549e59c6cbd51e3ef57866074b3af31a903d7f6 /Lib/compiler
parent4eb58df7baf84b50e90a46664cf50109d53d972f (diff)
downloadcpython-6989831828e780f636676b583cffed02beb74d5c.tar.gz
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/compiler')
-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 cde937b753..6d834e0c1d 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):