Skip to content

Commit e649e06

Browse files
authored
bpo-45296: Fix exit/quit message on Windows (GH-28577)
IDLE recognizes Ctrl-D, as on other systems, instead of Ctrl-Z.
1 parent a47d67c commit e649e06

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
@@ -66,6 +66,13 @@
6666
HOST = '127.0.0.1' # python execution server on localhost loopback
6767
PORT = 0 # someday pass in host, port for remote debug capability
6868

69+
try: # In case IDLE started with -n.
70+
eof = 'Ctrl-D (end-of-file)'
71+
exit.eof = eof
72+
quit.eof = eof
73+
except NameError: # In case python started with -S.
74+
pass
75+
6976
# Override warnings module to write to warning_stream. Initialize to send IDLE
7077
# internal warnings to the console. ScriptBinding.check_syntax() will
7178
# 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
@@ -40,6 +40,13 @@
4040

4141
LOCALHOST = '127.0.0.1'
4242

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

4451
def idle_formatwarning(message, category, filename, lineno, line=None):
4552
"""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)