Author gousaiyang
Recipients gousaiyang
Date 2020-09-30.01:46:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1601430417.52.0.930336195437.issue41887@roundup.psfhosted.org>
In-reply-to
Content
`ast.literal_eval` does not accept code with leading whitespaces, while `eval` accepts them, which is an inconsistency.

```
>>> import ast
>>> eval(' 1')
1
>>> ast.literal_eval(' 1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    1
IndentationError: unexpected indent
```
History
Date User Action Args
2020-09-30 01:46:57gousaiyangsetrecipients: + gousaiyang
2020-09-30 01:46:57gousaiyangsetmessageid: <1601430417.52.0.930336195437.issue41887@roundup.psfhosted.org>
2020-09-30 01:46:57gousaiyanglinkissue41887 messages
2020-09-30 01:46:57gousaiyangcreate