From 1035fb1641badda3ddd54d66f73e33ebf11365b8 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 27 Sep 2021 01:21:37 -0400 Subject: [PATCH 1/2] bpo-45296: Fix exit/quit message on Windows IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z. --- Lib/idlelib/pyshell.py | 7 +++++++ Lib/idlelib/run.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 4e7440038ac997..6c333b0bc3b818 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 3836727691229e..47c4cbdcb8c3f9 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.""" From a3e63a50eb32aaf8025cfef3d0eabfe294e6bf59 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 27 Sep 2021 01:24:34 -0400 Subject: [PATCH 2/2] Blurb --- Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst 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 00000000000000..52bade1e5327b9 --- /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 , which does not work in IDLE.