New submission from Jez Hill <jezh...@gmail.com>:
Following `from __future__ import unicode_literals` the expression `eval(" 'foo' ")` will return a `unicode` instance. However, using the same input, `ast.literal_eval(" 'foo' ")` will return a `str` instance. The caller's preference, that those plain single-quotes should a denote unicode literal, is respected by `eval()` but not by `ast.literal_eval()`. I propose that `ast.literal_eval()` be made sensitive to this preference, to bring it in line with `eval()`. ---------- messages: 334011 nosy: jez priority: normal severity: normal status: open title: mismatched eval() and ast.literal_eval() behavior with unicode_literals type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35777> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com