diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-10-04 00:46:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 00:46:44 (GMT) |
commit | e799aa8b92c195735f379940acd9925961ad04ec (patch) | |
tree | a0308940ce67e0535be861bfc94f3d830bba6734 /Lib/ast.py | |
parent | 7f54e563dc150cd670ca8df678437455c3a7f2cd (diff) | |
download | cpython-e799aa8b92c195735f379940acd9925961ad04ec.zip cpython-e799aa8b92c195735f379940acd9925961ad04ec.tar.gz cpython-e799aa8b92c195735f379940acd9925961ad04ec.tar.bz2 |
bpo-41887: omit leading spaces/tabs on ast.literal_eval (#22469)
Also document that eval() does this (the same way).
Diffstat (limited to 'Lib/ast.py')
-rw-r--r-- | Lib/ast.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -59,7 +59,7 @@ def literal_eval(node_or_string): sets, booleans, and None. """ if isinstance(node_or_string, str): - node_or_string = parse(node_or_string, mode='eval') + node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval') if isinstance(node_or_string, Expression): node_or_string = node_or_string.body def _raise_malformed_node(node): |