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 <1431094571.22.0.305385123522.issue24146@psf.upfronthosting.co.za>
In-reply-to
Content
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/ast.py", line 84, in literal_eval
    return _convert(node_or_string)
  File "/usr/lib/python3.4/ast.py", 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.
History
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: <1431094571.22.0.305385123522.issue24146@psf.upfronthosting.co.za>
2015-05-08 14:16:11serhiy.storchakalinkissue24146 messages
2015-05-08 14:16:11serhiy.storchakacreate