Skip to content

Commit 79e999f

Browse files
committed
port 3.14
1 parent d7b9ea5 commit 79e999f

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Doc/library/idle.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ Print Window
102102

103103
Close Window
104104
Close the current window (if an unsaved editor, ask to save; if an unsaved
105-
Shell, ask to quit execution). Calling ``exit()`` or ``close()`` in the Shell
106-
window also closes Shell. If this is the only window, also exit IDLE.
105+
Shell, ask to quit execution).
106+
107+
You can call ``exit()`` or ``quit()`` to close the Shell.
108+
If the :ref:`new interactive interpreter <tut-interac>` is enabled,
109+
IDLE also supports using ``exit`` or ``quit`` without the need to call them
110+
as functions. If this is the only window, closing it will also exit IDLE.
107111

108112
Exit IDLE
109113
Close all windows and quit IDLE (ask to save unsaved edit windows).

Lib/idlelib/News3.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ What's New in IDLE 3.14.0
33
Released on 2025-10-07
44
=========================
55

6+
gh-123369: IDLE now support for REPL-specific commands, like help, exit,
7+
license and quit, without the need to call them as functions.
68

79
gh-112936: IDLE - Include Shell menu in single-process mode,
810
though with Restart Shell and View Last Restart disabled.

Lib/idlelib/pyshell.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,19 @@ def execfile(self, filename, source=None):
682682
def runsource(self, source):
683683
"Extend base class method: Stuff the source in the line cache first"
684684
filename = self.stuffsource(source)
685+
686+
# Synchronize the new interactive shell in Python 3.13
687+
# help, exit, license and quit without the need to call them as functions
688+
# To disable, set the PYTHON_BASIC_REPL environment variable
689+
if not os.getenv('PYTHON_BASIC_REPL'):
690+
REPL_COMMANDS = {
691+
"quit": "quit()",
692+
"exit": "exit()",
693+
"help": "help()",
694+
"license": "license()"
695+
}
696+
source = REPL_COMMANDS.get(source, source)
697+
685698
# at the moment, InteractiveInterpreter expects str
686699
assert isinstance(source, str)
687700
# InteractiveInterpreter.runsource() calls its runcode() method,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
IDLE now support for REPL-specific commands, like :kbd:`help`, :kbd:`exit`,
2+
:kbd:`license` and :kbd:`quit`, without the need to call them as functions.

0 commit comments

Comments
 (0)