summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/compiler/symbols.py6
-rw-r--r--Tools/compiler/compiler/symbols.py6
2 files changed, 8 insertions, 4 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):
diff --git a/Tools/compiler/compiler/symbols.py b/Tools/compiler/compiler/symbols.py
index cde937b..6d834e0 100644
--- a/Tools/compiler/compiler/symbols.py
+++ b/Tools/compiler/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):