[Python-checkins] Warn that compile() can crash when compiling to an AST object (GH-6043) (GH-6045)

Brett Cannon webhook-mailer at python.org
Fri Mar 9 16:40:29 EST 2018

commit: fc5e0956fe492551c658ebe325ba77c0aa4f2adb
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Brett Cannon <brettcannon at users.noreply.github.com>
date: 2018-03-09T13:40:26-08:00

Warn that compile() can crash when compiling to an AST object (GH-6043) (GH-6045)

(cherry picked from commit f7a6ff6fcab32a53f262ba3f8a072c27afc330d7)

Co-authored-by: Brett Cannon <brettcannon at users.noreply.github.com>

M Doc/library/functions.rst

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index bfb813cf3906..3ddd280f77eb 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -274,6 +274,12 @@ are always available.  They are listed here in alphabetical order.
       character.  This is to facilitate detection of incomplete and complete
       statements in the :mod:`code` module.
+   .. warning::
+      It is possible to crash the Python interpreter with a
+      sufficiently large/complex string when compiling to an AST
+      object due to stack depth limitations in Python's AST compiler.
    .. versionchanged:: 3.2
       Allowed use of Windows and Mac newlines.  Also input in ``'exec'`` mode
       does not have to end in a newline anymore.  Added the *optimize* parameter.

More information about the Python-checkins mailing list