summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-09-28 12:35:04 (GMT)
committerGitHub <noreply@github.com>2021-09-28 12:35:04 (GMT)
commit813fbba4cab4556e55d6044c05725a26ec20b648 (patch)
tree0d8f9c9c06656dba93afe368825d1a90e8a75a57
parent94d19f606fa18a1c4d2faca1caf2f470a8ce6d46 (diff)
downloadcpython-813fbba4cab4556e55d6044c05725a26ec20b648.zip
cpython-813fbba4cab4556e55d6044c05725a26ec20b648.tar.gz
cpython-813fbba4cab4556e55d6044c05725a26ec20b648.tar.bz2
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28601)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z. (cherry picked from commit e649e0658ff2af87b07d994c05ae048e16e31aae) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
-rwxr-xr-xLib/idlelib/pyshell.py7
-rw-r--r--Lib/idlelib/run.py7
-rw-r--r--Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst2
3 files changed, 16 insertions, 0 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index fea3762..ee529fa 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -60,6 +60,13 @@ from idlelib.undo import UndoDelegator
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 07e9a2b..dda9711 100644
--- a/Lib/idlelib/run.py
+++ b/Lib/idlelib/run.py
@@ -39,6 +39,13 @@ if not hasattr(sys.modules['idlelib.run'], 'firstrun'):
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 0000000..52bade1
--- /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.