Skip to content

Commit 813fbba

Browse files
bpo-45296: Fix exit/quit message on Windows (GH-28577) (GH-28601)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z. (cherry picked from commit e649e06) Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 94d19f6 commit 813fbba

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Lib/idlelib/pyshell.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
HOST = '127.0.0.1' # python execution server on localhost loopback
6161
PORT = 0 # someday pass in host, port for remote debug capability
6262

63+
try: # In case IDLE started with -n.
64+
eof = 'Ctrl-D (end-of-file)'
65+
exit.eof = eof
66+
quit.eof = eof
67+
except NameError: # In case python started with -S.
68+
pass
69+
6370
# Override warnings module to write to warning_stream. Initialize to send IDLE
6471
# internal warnings to the console. ScriptBinding.check_syntax() will
6572
# temporarily redirect the stream to the shell window to display warnings when

Lib/idlelib/run.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939

4040
LOCALHOST = '127.0.0.1'
4141

42+
try:
43+
eof = 'Ctrl-D (end-of-file)'
44+
exit.eof = eof
45+
quit.eof = eof
46+
except NameError: # In case subprocess started with -S (maybe in future).
47+
pass
48+
4249

4350
def idle_formatwarning(message, category, filename, lineno, line=None):
4451
"""Format warnings the IDLE way."""
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On Windows, change exit/quit message to suggest Ctrl-D, which works, instead
2+
of <Ctrl-Z Return>, which does not work in IDLE.

0 commit comments

Comments
 (0)