Skip to content

Commit fcf1d00

Browse files
authored
bpo-26806: add 30 to the recursion limit in IDLE's shell (GH-13944)
This is done to compensate for the extra stack frames added by IDLE itself, which cause problems when setting the recursion limit to low values. This wraps sys.setrecursionlimit() and sys.getrecursionlimit() as invisibly as possible.
1 parent 45bc61b commit fcf1d00

File tree

6 files changed

+181
-135
lines changed

6 files changed

+181
-135
lines changed

Doc/library/idle.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@ or ``print`` or ``write`` to sys.stdout or sys.stderr,
713713
IDLE should be started in a command line window. The secondary subprocess
714714
will then be attached to that window for input and output.
715715

716+
The IDLE code running in the execution process adds frames to the call stack
717+
that would not be there otherwise. IDLE wraps ``sys.getrecursionlimit`` and
718+
``sys.setrecursionlimit`` to reduce the effect of the additional stack frames.
719+
716720
If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``,
717721
IDLE's changes are lost and input from the keyboard and output to the screen
718722
will not work correctly.

Lib/idlelib/NEWS.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Released on 2019-10-20?
33
======================================
44

55

6+
bpo-26806: To compensate for stack frames added by IDLE and avoid
7+
possible problems with low recursion limits, add 30 to limits in the
8+
user code execution process. Subtract 30 when reporting recursion
9+
limits to make this addition mostly transparent.
10+
611
bpo-37325: Fix tab focus traversal order for help source and custom
712
run dialogs.
813

0 commit comments

Comments
 (0)