diff options
author | Ashley Whetter <AWhetter@users.noreply.github.com> | 2019-10-18 01:00:22 -0700 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-10-18 11:00:22 +0300 |
commit | dedb99acdb5bbc179872235f975248133d3fb440 (patch) | |
tree | ca1ae285d433891659497fc6e192b66469563bcc | |
parent | bpo-32758: Warn that compile() can crash when compiling to an AST object (GH-... (diff) | |
download | cpython-dedb99acdb5bbc179872235f975248133d3fb440.tar.gz cpython-dedb99acdb5bbc179872235f975248133d3fb440.tar.bz2 cpython-dedb99acdb5bbc179872235f975248133d3fb440.zip |
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter (GH-5960) (GH-16565)
(cherry picked from commit 7a7f100eb352d08938ee0f5ba59c18f56dc4a7b5)
Co-authored-by: Brett Cannon <brettcannon@users.noreply.github.com>
-rw-r--r-- | Doc/library/ast.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 6d5855b52bc..b04a92d33ad 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -129,6 +129,11 @@ and classes for traversing abstract syntax trees: Parse the source into an AST node. Equivalent to ``compile(source, 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) @@ -142,6 +147,11 @@ and classes for traversing abstract syntax trees: capable of evaluating arbitrarily complex expressions, for example involving 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. + .. function:: get_docstring(node, clean=True) |