diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst index 02e7de77322e99..ecde3cac665d9b 100644 --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -11,8 +11,8 @@ Invoking the Interpreter ======================== The Python interpreter is usually installed as |usr_local_bin_python_x_dot_y_literal| -on those machines where it is available; putting :file:`/usr/local/bin` in your -Unix shell's search path makes it possible to start it by typing the command: +on those machines where it is available; Ensure /usr/local/bin is included in your Unix +shell's search path to start the interpreter by typing the command: .. code-block:: text @@ -23,10 +23,10 @@ is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., :file:`/usr/local/python` is a popular alternative location.) -On Windows machines where you have installed Python from the :ref:`Microsoft Store -`, the |python_x_dot_y_literal| command will be available. If you have -the :ref:`py.exe launcher ` installed, you can use the :file:`py` -command. See :ref:`setting-envvars` for other ways to launch Python. +On Windows, if you installed Python from the :ref:Microsoft Store , +the |python_x_dot_y_literal| command will be available. Alternatively, if you have the +:ref:py.exe launcher installed, you can use the :file:py command to launch +Python. Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on Windows) at the primary prompt causes the interpreter to exit with a zero exit @@ -37,7 +37,8 @@ The interpreter's line-editing features include interactive editing, history substitution and code completion on systems that support the `GNU Readline `_ library. Perhaps the quickest check to see whether command line editing is supported is -typing :kbd:`Control-P` to the first Python prompt you get. If it beeps, you +typing :kbd:`Control-P` to the first Python prompt you get. i.e. Pressing :kbd:Control-P +moves to the previous command in the command history. If it beeps, you have command line editing; see Appendix :ref:`tut-interacting` for an introduction to the keys. If nothing appears to happen, or if ``^P`` is echoed, command line editing isn't available; you'll only be able to use diff --git a/Lib/_pyrepl/fancy_termios.py b/Lib/_pyrepl/fancy_termios.py index 5b85cb0f52521f..0468b9a2670267 100644 --- a/Lib/_pyrepl/fancy_termios.py +++ b/Lib/_pyrepl/fancy_termios.py @@ -40,7 +40,9 @@ def as_list(self): self.lflag, self.ispeed, self.ospeed, - self.cc, + # Always return a copy of the control characters list to ensure + # there are not any additional references to self.cc + self.cc[:], ] def copy(self): diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-12-29-15-09-21.gh-issue-128330.IaYL7G.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-12-29-15-09-21.gh-issue-128330.IaYL7G.rst new file mode 100644 index 00000000000000..8fe628d18f4bd4 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-12-29-15-09-21.gh-issue-128330.IaYL7G.rst @@ -0,0 +1 @@ +Restore terminal control characters on REPL exit.