[Python-checkins] bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28600)
ambv
webhook-mailer at python.org
Tue Sep 28 08:35:28 EDT 2021
https://github.com/python/cpython/commit/acd46feff3c06d3f1d00ab850e530c519445a737
commit: acd46feff3c06d3f1d00ab850e530c519445a737
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-09-28T14:35:23+02:00
summary:
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28600)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z.
(cherry picked from commit e649e0658ff2af87b07d994c05ae048e16e31aae)
Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
files:
A Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst
M Lib/idlelib/pyshell.py
M Lib/idlelib/run.py
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index 4e7440038ac99..6c333b0bc3b81 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -66,6 +66,13 @@
HOST = '127.0.0.1' # python execution server on localhost loopback
PORT = 0 # someday pass in host, port for remote debug capability
+try: # In case IDLE started with -n.
+ eof = 'Ctrl-D (end-of-file)'
+ exit.eof = eof
+ quit.eof = eof
+except NameError: # In case python started with -S.
+ pass
+
# Override warnings module to write to warning_stream. Initialize to send IDLE
# internal warnings to the console. ScriptBinding.check_syntax() will
# temporarily redirect the stream to the shell window to display warnings when
diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py
index 3836727691229..47c4cbdcb8c3f 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -40,6 +40,13 @@
LOCALHOST = '127.0.0.1'
+try:
+ eof = 'Ctrl-D (end-of-file)'
+ exit.eof = eof
+ quit.eof = eof
+except NameError: # In case subprocess started with -S (maybe in future).
+ pass
+
def idle_formatwarning(message, category, filename, lineno, line=None):
"""Format warnings the IDLE way."""
diff --git a/Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst b/Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst
new file mode 100644
index 0000000000000..52bade1e5327b
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst
@@ -0,0 +1,2 @@
+On Windows, change exit/quit message to suggest Ctrl-D, which works, instead
+of <Ctrl-Z Return>, which does not work in IDLE.
More information about the Python-checkins
mailing list