]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter...
authorAshley Whetter <AWhetter@users.noreply.github.com>
Fri, 18 Oct 2019 08:00:22 +0000 (01:00 -0700)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 18 Oct 2019 08:00:22 +0000 (11:00 +0300)
(cherry picked from commit 7a7f100eb352d08938ee0f5ba59c18f56dc4a7b5)

Co-authored-by: Brett Cannon <brettcannon@users.noreply.github.com>
Doc/library/ast.rst

index 6d5855b52bcce3df4fa9394574e2831da5047411..b04a92d33adc53c8804b15952f188fdab6c4d812 100644 (file)
@@ -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)