bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault the interpreter (GH-5960)

This commit is contained in:
Brett Cannon 2018-03-09 12:03:22 -08:00 committed by GitHub
parent 83d7062d2d
commit 7a7f100eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View 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.