This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients benjamin.peterson, georg.brandl, larry, mark.dickinson, serhiy.storchaka
Date 2015-05-08.14:16:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
No it doesn't support all Python operators.

>>> ast.literal_eval('2*3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/", line 84, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python3.4/", line 83, in _convert
    raise ValueError('malformed node or string: ' + repr(node))
ValueError: malformed node or string: <_ast.BinOp object at 0xb6f8446c>

And shouldn't. It supports "+" and "-" only because they are needed for support of complex "literals". It is unintentional side effect, that ast.literal_eval() supports not only "2+3j", but "2+3" too.
Date User Action Args
2015-05-08 14:16:11serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, mark.dickinson, larry, benjamin.peterson
2015-05-08 14:16:11serhiy.storchakasetmessageid: <>
2015-05-08 14:16:11serhiy.storchakalinkissue24146 messages
2015-05-08 14:16:11serhiy.storchakacreate