diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-09-14 22:45:57 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-09-14 22:45:57 (GMT) |
commit | 652a22437a973dddef7f82d0cc8271d60da7de36 (patch) | |
tree | f00044b0d78496d2b6536999698274d9e26cd608 | |
parent | 9ee78f7d61fdce7bd3e712346460bdbc026efc23 (diff) | |
download | cpython-652a22437a973dddef7f82d0cc8271d60da7de36.zip cpython-652a22437a973dddef7f82d0cc8271d60da7de36.tar.gz cpython-652a22437a973dddef7f82d0cc8271d60da7de36.tar.bz2 |
The object-being sliced in an assignment to a slice is referenced, not
bound.
When a Yield() node is visited, assign to the generator attribute of
the scope, not the visitor.
-rw-r--r-- | Lib/compiler/symbols.py | 4 | ||||
-rw-r--r-- | Tools/compiler/compiler/symbols.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Lib/compiler/symbols.py b/Lib/compiler/symbols.py index 946a8b1..bf9a724 100644 --- a/Lib/compiler/symbols.py +++ b/Lib/compiler/symbols.py @@ -321,7 +321,7 @@ class SymbolVisitor: self.visit(n, scope, 0) def visitSlice(self, node, scope, assign=0): - self.visit(node.expr, scope, assign) + self.visit(node.expr, scope, 0) if node.lower: self.visit(node.lower, scope, 0) if node.upper: @@ -353,7 +353,7 @@ class SymbolVisitor: # a yield statement signals a generator def visitYield(self, node, scope): - self.generator = 1 + scope.generator = 1 self.visit(node.value, scope) def sort(l): diff --git a/Tools/compiler/compiler/symbols.py b/Tools/compiler/compiler/symbols.py index 946a8b1..bf9a724 100644 --- a/Tools/compiler/compiler/symbols.py +++ b/Tools/compiler/compiler/symbols.py @@ -321,7 +321,7 @@ class SymbolVisitor: self.visit(n, scope, 0) def visitSlice(self, node, scope, assign=0): - self.visit(node.expr, scope, assign) + self.visit(node.expr, scope, 0) if node.lower: self.visit(node.lower, scope, 0) if node.upper: @@ -353,7 +353,7 @@ class SymbolVisitor: # a yield statement signals a generator def visitYield(self, node, scope): - self.generator = 1 + scope.generator = 1 self.visit(node.value, scope) def sort(l): |