]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39159: Declare error that might be raised from literal_eval (GH-19899)
authorBatuhan Taskaya <isidentical@gmail.com>
Tue, 22 Dec 2020 00:15:40 +0000 (03:15 +0300)
committerGitHub <noreply@github.com>
Tue, 22 Dec 2020 00:15:40 +0000 (16:15 -0800)
Doc/library/ast.rst

index 8a5c6ec5f1279d20ffc803ad821a23e2538fd62a..9149a53e0dca8fe1f1369e64b663466bd1464975 100644 (file)
@@ -1576,7 +1576,7 @@ and classes for traversing abstract syntax trees:
    Safely evaluate an expression node or a string containing a Python literal or
    container display.  The string or node provided may only consist of the
    following Python literal structures: strings, bytes, numbers, tuples, lists,
-   dicts, sets, booleans, and ``None``.
+   dicts, sets, booleans, ``None`` and ``Ellipsis``.
 
    This can be used for safely evaluating strings containing Python values from
    untrusted sources without the need to parse the values oneself.  It is not
@@ -1588,6 +1588,10 @@ and classes for traversing abstract syntax trees:
       sufficiently large/complex string due to stack depth limitations
       in Python's AST compiler.
 
+      It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`,
+      :exc:`MemoryError` and :exc:`RecursionError` depending on the malformed
+      input.
+
    .. versionchanged:: 3.2
       Now allows bytes and set literals.