This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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

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