Skip to content

Commit fbc7723

Browse files
authored
bpo-39159: Declare error that might be raised from literal_eval (GH-19899)
1 parent b8fde8b commit fbc7723

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/ast.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ and classes for traversing abstract syntax trees:
15761576
Safely evaluate an expression node or a string containing a Python literal or
15771577
container display. The string or node provided may only consist of the
15781578
following Python literal structures: strings, bytes, numbers, tuples, lists,
1579-
dicts, sets, booleans, and ``None``.
1579+
dicts, sets, booleans, ``None`` and ``Ellipsis``.
15801580

15811581
This can be used for safely evaluating strings containing Python values from
15821582
untrusted sources without the need to parse the values oneself. It is not
@@ -1588,6 +1588,10 @@ and classes for traversing abstract syntax trees:
15881588
sufficiently large/complex string due to stack depth limitations
15891589
in Python's AST compiler.
15901590

1591+
It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`,
1592+
:exc:`MemoryError` and :exc:`RecursionError` depending on the malformed
1593+
input.
1594+
15911595
.. versionchanged:: 3.2
15921596
Now allows bytes and set literals.
15931597

0 commit comments

Comments
 (0)