diff options
| author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-10-04 03:46:44 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-03 17:46:44 -0700 |
| commit | e799aa8b92c195735f379940acd9925961ad04ec (patch) | |
| tree | a0308940ce67e0535be861bfc94f3d830bba6734 /Lib/ast.py | |
| parent | 7f54e563dc150cd670ca8df678437455c3a7f2cd (diff) | |
| download | cpython-git-e799aa8b92c195735f379940acd9925961ad04ec.tar.gz | |
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
diff --git a/Lib/ast.py b/Lib/ast.py index d860917f4d..d8bd337370 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -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): |
