[issue25335] ast.literal_eval fails to parse numbers with leading "+"

R. David Murray report at bugs.python.org
Wed Oct 7 12:08:47 EDT 2015


R. David Murray added the comment:

This works in python3.  I'm not sure why the two pythons are different, there's no obvious issue about this being changed in python3, so perhaps it was something that "just happened" while changing other things.  

literal_eval is *not* a general expression evaluator, so I'm actually surprised this works in python3...apparently support for + and - is required for evaling complex numbers, but there must be something different about the parse trees generated in python2 vs python3, since python2 literal_eval handles complex numbers fine.

I'm not sure this is a bug, but *if* we decide it is something we'd should make work the same in python2 and python3, someone will probably have to invest the time in figuring out what the difference between the two is.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25335>
_______________________________________


More information about the Python-bugs-list mailing list