diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2006-03-14 13:21:14 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2006-03-14 13:21:14 (GMT) |
commit | cb35b95f86062394437da42a3bd78085c4302b78 (patch) | |
tree | 480e4fd9296053b120c03c349f317d4d03cd1456 /Lib/compiler | |
parent | 7580146b5c7025976f0907a9893e01dc3d3d3457 (diff) | |
download | cpython-cb35b95f86062394437da42a3bd78085c4302b78.zip cpython-cb35b95f86062394437da42a3bd78085c4302b78.tar.gz cpython-cb35b95f86062394437da42a3bd78085c4302b78.tar.bz2 |
Teach the compiler module about augmented assignment to tuple subscripts
Diffstat (limited to 'Lib/compiler')
-rw-r--r-- | Lib/compiler/pycodegen.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index 2b3a24f..f25b3fb 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -1045,8 +1045,6 @@ class CodeGenerator: self.emit('STORE_SLICE+%d' % slice) def visitAugSubscript(self, node, mode): - if len(node.subs) > 1: - raise SyntaxError, "augmented assignment to tuple is not possible" if mode == "load": self.visitSubscript(node, 1) elif mode == "store": @@ -1151,10 +1149,10 @@ class CodeGenerator: self.visit(node.expr) for sub in node.subs: self.visit(sub) - if aug_flag: - self.emit('DUP_TOPX', 2) if len(node.subs) > 1: self.emit('BUILD_TUPLE', len(node.subs)) + if aug_flag: + self.emit('DUP_TOPX', 2) if node.flags == 'OP_APPLY': self.emit('BINARY_SUBSCR') elif node.flags == 'OP_ASSIGN': |