From e649e0658ff2af87b07d994c05ae048e16e31aae Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 28 Sep 2021 08:05:56 -0400 Subject: bpo-45296: Fix exit/quit message on Windows (GH-28577) IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z. --- Lib/idlelib/pyshell.py | 7 +++++++ Lib/idlelib/run.py | 7 +++++++ Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index 4e74400..6c333b0 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -66,6 +66,13 @@ use_subprocess = False 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 3836727..47c4cbd 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -40,6 +40,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 , which does not work in IDLE. -- cgit v0.12