diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index fea3762461e99e..ee529fa2ff7e36 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -60,6 +60,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 diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 07e9a2bf9ceeae..dda9711dcf7aed 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -39,6 +39,13 @@ 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 index 00000000000000..52bade1e5327b9 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2021-09-27-01-21-59.bpo-45296.9H8rdY.rst @@ -0,0 +1,2 @@ +On Windows, change exit/quit message to suggest Ctrl-D, which works, instead +of , which does not work in IDLE.