]> granicus.if.org Git - python/commitdiff
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter...
authorBrett Cannon <brettcannon@users.noreply.github.com>
Fri, 9 Mar 2018 20:03:22 +0000 (12:03 -0800)
committerGitHub <noreply@github.com>
Fri, 9 Mar 2018 20:03:22 +0000 (12:03 -0800)
Doc/library/ast.rst

index b7f610ba8b2a5fad7f7d40f1cc3a55c1c001fb30..a75a6afbf2d7df6538f6ea652477f9d284724c68 100644 (file)
@@ -113,6 +113,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)
 
@@ -126,6 +131,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.
+
    .. versionchanged:: 3.2
       Now allows bytes and set literals.