]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28601)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 28 Sep 2021 12:35:04 +0000 (05:35 -0700)
committerGitHub <noreply@github.com>
Tue, 28 Sep 2021 12:35:04 +0000 (14:35 +0200)
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>
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 fea3762461e99eabde888c3054dad4750b038480..ee529fa2ff7e36d6383e0d66d0c5068818275570 100755 (executable)
@@ -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
index 07e9a2bf9ceeae1d356e404c58c2247cd43a688f..dda9711dcf7aed859656b5b67887e4541b18494f 100644 (file)
@@ -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 (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.