diff options
author | 2020-12-22 03:15:40 +0300 | |
---|---|---|
committer | 2020-12-21 16:15:40 -0800 | |
commit | fbc7723778be01b8f3bb72d2dcac15ab9fbb9923 (patch) | |
tree | d14e2f473bfa0a7327e0c2a9f8ea0a3b44a17832 /Doc/library | |
parent | bpo-42008: Fix internal _random.Random() seeding for the one argument case (G... (diff) | |
download | cpython-fbc7723778be01b8f3bb72d2dcac15ab9fbb9923.tar.gz cpython-fbc7723778be01b8f3bb72d2dcac15ab9fbb9923.tar.bz2 cpython-fbc7723778be01b8f3bb72d2dcac15ab9fbb9923.zip |
bpo-39159: Declare error that might be raised from literal_eval (GH-19899)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/ast.rst | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 8a5c6ec5f12..9149a53e0dc 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -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. |