[issue25335] ast.literal_eval fails to parse numbers with leading "+"
Terry J. Reedy
report at bugs.python.org
Fri Oct 9 15:56:53 EDT 2015
Terry J. Reedy added the comment:
I am pretty sure the 2.x anomaly is tied up with having short ints plus the anomaly of having one more negative than positive int.
>>> 2147483648
2147483648L
>>> -(2147483648)
-2147483648L
>>> -2147483648
-2147483648
I believe the last result was once the same as the middle result because I remember reading or even writing the explanation that -2147483648 is (was) parsed as -(2147483648) (or something like this).
Raymond' also made more liberal in other ways: literal_eval('(+1)+(-1)') in now 0 instead of ValueError: malformed string. The 3.x doc was not changed to match, though.
----------
nosy: +terry.reedy
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25335>
_______________________________________
More information about the Python-bugs-list
mailing list