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@udel.edu>
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 @@
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