Georg Brandl ge...@python.org added the comment:
Alex: IMO the operator support is only required for complex literals.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
New submission from Alex Gaynor alex.gay...@gmail.com:
In 2.7 ast.literal_eval blows up with a set for input:
import ast
ast.literal_eval({1})
--
messages: 148897
nosy: alex
priority: low
severity: normal
status: open
title: ast.literal_eval fails on sets
versions: Python 2.7
Alex Gaynor alex.gay...@gmail.com added the comment:
Patch with tests
--
keywords: +patch
Added file: http://bugs.python.org/file23859/x.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
Changes by Antoine Pitrou pit...@free.fr:
--
nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536
___
Brian Curtin br...@python.org added the comment:
I don't profess to have any special ast knowledge, but given the context around
there and the fact that it works...it looks fine to me.
--
nosy: +brian.curtin
___
Python tracker rep...@bugs.python.org
Nick Coghlan ncogh...@gmail.com added the comment:
Dict and Set comprehensions are also broken:
{1 for x in ()}
set([])
{1:2 for x in ()}
{}
ast.literal_eval({1 for x in ()})
Traceback (most recent call last):
File stdin, line 1, in module
File /usr/lib64/python2.7/ast.py, line 80, in
Alex Gaynor alex.gay...@gmail.com added the comment:
There's no support for comprehensions of any sort, and confusingly limited
support for arithmetic ops, I'd like to keep the scope of this issue small,
basically backporting 90bf0631bfb8 and adding the tests (which I can also add
to
Changes by Benjamin Peterson benja...@python.org:
--
resolution: - invalid
status: open - closed
superseder: - ast.literal_eval does not handled new set literals
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13536