[New-bugs-announce] [issue10091] ast.literal_eval does not handled new set literals

nestor report at bugs.python.org
Wed Oct 13 21:36:42 CEST 2010


New submission from nestor <nestornissen at gmail.com>:

>>> import ast
>>> eval('{1:11,2:22}')
{1: 11, 2: 22}
>>> ast.literal_eval('{1:11,2:22}')
{1: 11, 2: 22}

>>> eval('{1,2}')
{1, 2}
>>> ast.literal_eval('{1,2}')
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    ast.literal_eval('{1,2}')
  File "C:\Python31\lib\ast.py", line 80, in literal_eval
    return _convert(node_or_string)
  File "C:\Python31\lib\ast.py", line 79, in _convert
    raise ValueError('malformed string')
ValueError: malformed string

>>> 

I haven't tested for 2.7 or 3.2 but this bug probably applies also there.

----------
components: Library (Lib)
messages: 118568
nosy: aronacher, benjamin.peterson, georg.brandl, gpolo, mark.dickinson, nestor, rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: ast.literal_eval does not handled new set literals
type: behavior
versions: Python 3.1

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


More information about the New-bugs-announce mailing list