bpo-32758: Warn that ast.parse() and ast.literal_eval() can segfault … · python/cpython@b316c44 (original) (raw)

Original file line number Diff line number Diff line change
@@ -113,6 +113,11 @@ and classes for traversing abstract syntax trees:
113 113 Parse the source into an AST node. Equivalent to ``compile(source,
114 114 filename, mode, ast.PyCF_ONLY_AST)``.
115 115
116 + .. warning::
117 + It is possible to crash the Python interpreter with a
118 + sufficiently large/complex string due to stack depth limitations
119 + in Python's AST compiler.
120 +
116 121
117 122 .. function:: literal_eval(node_or_string)
118 123
@@ -126,6 +131,11 @@ and classes for traversing abstract syntax trees:
126 131 capable of evaluating arbitrarily complex expressions, for example involving
127 132 operators or indexing.
128 133
134 + .. warning::
135 + It is possible to crash the Python interpreter with a
136 + sufficiently large/complex string due to stack depth limitations
137 + in Python's AST compiler.
138 +
129 139 .. versionchanged:: 3.2
130 140 Now allows bytes and set literals.
131 141