[issue41887] ast.literal_eval does not accept strings with leading whitespaces

Batuhan Taskaya report at bugs.python.org
Wed Sep 30 11:58:30 EDT 2020


Batuhan Taskaya <isidentical at gmail.com> added the comment:

Looks like skipping the leading whitespace is an undocumented behavior for eval() introduced back in 1992 (f08ab0ad158f88f05dd923b129d2397e1882be14). I don't think that bringing it to the literal_eval is a good idea, at least after this much of a time. If so, both of them should be explicitly documented or at least mentioned in the source code (to avoid confusion).

----------
nosy: +pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41887>
_______________________________________


More information about the Python-bugs-list mailing list