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

Guido van Rossum report at bugs.python.org
Wed Sep 30 16:33:49 EDT 2020


Guido van Rossum <guido at python.org> added the comment:

Hm, I'm not sure. ast.literal_eval() does accept trailing whitespace, and embedded whitespace.

```
>>> ast.literal_eval("- ( 1\n)\n")
-1
>>> 
```

So I think it should start accepting leading whitespace too (but only in a feature release, so 3.10).

----------

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


More information about the Python-bugs-list mailing list