mirror of
https://github.com/python/cpython.git
synced 2025-10-02 05:12:23 +00:00
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter (GH-5960) (GH-6041)
(cherry picked from commit 7a7f100eb3
)
Co-authored-by: Brett Cannon <brettcannon@users.noreply.github.com>
This commit is contained in:
parent
3c39beb65d
commit
f2fffd41b4
1 changed files with 10 additions and 0 deletions
|
@ -113,6 +113,11 @@ and classes for traversing abstract syntax trees:
|
||||||
Parse the source into an AST node. Equivalent to ``compile(source,
|
Parse the source into an AST node. Equivalent to ``compile(source,
|
||||||
filename, mode, ast.PyCF_ONLY_AST)``.
|
filename, mode, ast.PyCF_ONLY_AST)``.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
It is possible to crash the Python interpreter with a
|
||||||
|
sufficiently large/complex string due to stack depth limitations
|
||||||
|
in Python's AST compiler.
|
||||||
|
|
||||||
|
|
||||||
.. function:: literal_eval(node_or_string)
|
.. function:: literal_eval(node_or_string)
|
||||||
|
|
||||||
|
@ -126,6 +131,11 @@ and classes for traversing abstract syntax trees:
|
||||||
capable of evaluating arbitrarily complex expressions, for example involving
|
capable of evaluating arbitrarily complex expressions, for example involving
|
||||||
operators or indexing.
|
operators or indexing.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
It is possible to crash the Python interpreter with a
|
||||||
|
sufficiently large/complex string due to stack depth limitations
|
||||||
|
in Python's AST compiler.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
Now allows bytes and set literals.
|
Now allows bytes and set literals.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue