]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45296: Fix exit/quit message on Windows (GH-28577)
authorTerry Jan Reedy <tjreedy@udel.edu>
Tue, 28 Sep 2021 12:05:56 +0000 (08:05 -0400)
committerGitHub <noreply@github.com>
Tue, 28 Sep 2021 12:05:56 +0000 (14:05 +0200)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z.

Lib/idlelib/pyshell.py
Lib/idlelib/run.py
Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst [new file with mode: 0644]

index 4e7440038ac997cd91569e97c1bbdc5f6e6da546..6c333b0bc3b81836a8af8a7a8e2a011fce1d3f02 100755 (executable)
@@ -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
index 3836727691229e3e81ef4bc3db666ec76e2efb90..47c4cbdcb8c3f9e2200b278a878ca78358331e9a 100644 (file)
@@ -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 (file)
index 0000000..52bade1
--- /dev/null
@@ -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.