[New-bugs-announce] [issue6978] compiler.transformer dict key bug d[1, ] = 1

Kees Bos report at bugs.python.org
Wed Sep 23 15:35:35 CEST 2009


New submission from Kees Bos <k.bos at zx.nl>:

compiler.parse("d[1] = 1") should have a single tuple as subs


>>> compiler.parse("d[1] = 1")
Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN',
[Const(1)])], Const(1))]))
>>> compiler.parse("d[1,] = 2")
Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN',
[Const(1)])], Const(2))]))
>>> compiler.parse("d[1,2] = 3")
Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1),
Const(2)])], Const(3))]))
>>> compiler.parse("d[(1,)] = 2")
Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN',
[Tuple([Const(1)])])], Const(2))]))

----------
components: Library (Lib)
files: compiler.transformer.patch
keywords: patch
messages: 93034
nosy: kees
severity: normal
status: open
title: compiler.transformer dict key bug d[1,] = 1
type: behavior
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file14957/compiler.transformer.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6978>
_______________________________________


More information about the New-bugs-announce mailing list