Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ Print Window

Close Window
Close the current window (if an unsaved editor, ask to save; if an unsaved
Shell, ask to quit execution). Calling ``exit()`` or ``close()`` in the Shell
window also closes Shell. If this is the only window, also exit IDLE.
Shell, ask to quit execution).

You can call ``exit()`` or ``quit()`` to close the Shell.
If the :ref:`new interactive interpreter <tut-interac>` is enabled,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misleading, since it does not use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the PYTHON_BASIC_REPL environment variable here to decide whether to enable this feature. If PYTHON_BASIC_REPL is set, the new interactive interpreter will not be enabled, also this feature

IDLE also supports using ``exit`` or ``quit`` without the need to call them
as functions. If this is the only window, closing it will also exit IDLE.

Exit IDLE
Close all windows and quit IDLE (ask to save unsaved edit windows).
Expand Down
2 changes: 2 additions & 0 deletions Lib/idlelib/News3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ What's New in IDLE 3.14.0
Released on 2025-10-07
=========================

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

gh-112936: IDLE - Include Shell menu in single-process mode,
though with Restart Shell and View Last Restart disabled.
Expand Down
13 changes: 13 additions & 0 deletions Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,19 @@ def execfile(self, filename, source=None):
def runsource(self, source):
"Extend base class method: Stuff the source in the line cache first"
filename = self.stuffsource(source)

# Synchronize the new interactive shell in Python 3.13
# help, exit, license and quit without the need to call them as functions
# To disable, set the PYTHON_BASIC_REPL environment variable
if not os.getenv('PYTHON_BASIC_REPL'):
REPL_COMMANDS = {
"quit": "quit()",
"exit": "exit()",
"help": "help()",
"license": "license()"
}
source = REPL_COMMANDS.get(source, source)

# at the moment, InteractiveInterpreter expects str
assert isinstance(source, str)
# InteractiveInterpreter.runsource() calls its runcode() method,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IDLE now support for REPL-specific commands, like :kbd:`help`, :kbd:`exit`,
:kbd:`license` and :kbd:`quit`, without the need to call them as functions.
Loading