[New-bugs-announce] [issue35777] mismatched eval() and ast.literal_eval() behavior with unicode_literals
Jez Hill
report at bugs.python.org
Fri Jan 18 16:26:40 EST 2019
New submission from Jez Hill <jezhill at 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 <report at bugs.python.org>
<https://bugs.python.org/issue35777>
_______________________________________
More information about the New-bugs-announce
mailing list