Skip to content

Commit

Permalink
bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault …
Browse files Browse the repository at this point in the history
…the interpreter (pythonGH-5960)

(cherry picked from commit 7a7f100)

Co-authored-by: Brett Cannon <brettcannon@users.noreply.github.com>
  • Loading branch information
brettcannon authored and miss-islington committed Mar 9, 2018
1 parent 3c39beb commit f3f8eec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Doc/library/ast.rst
Expand Up @@ -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)

Expand All @@ -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.

Expand Down

0 comments on commit f3f8eec

Please sign in to comment.