Commit 7a7f100e authored by Brett Cannon's avatar Brett Cannon Committed by GitHub

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

parent 83d7062d
...@@ -113,6 +113,11 @@ and classes for traversing abstract syntax trees: ...@@ -113,6 +113,11 @@ and classes for traversing abstract syntax trees:
Parse the source into an AST node. Equivalent to ``compile(source, Parse the source into an AST node. Equivalent to ``compile(source,
filename, mode, ast.PyCF_ONLY_AST)``. 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) .. function:: literal_eval(node_or_string)
...@@ -126,6 +131,11 @@ and classes for traversing abstract syntax trees: ...@@ -126,6 +131,11 @@ and classes for traversing abstract syntax trees:
capable of evaluating arbitrarily complex expressions, for example involving capable of evaluating arbitrarily complex expressions, for example involving
operators or indexing. 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 .. versionchanged:: 3.2
Now allows bytes and set literals. Now allows bytes and set literals.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment