]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-128330: Terminal control characters should be restored on repl exit (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 23 Jan 2025 17:55:28 +0000 (18:55 +0100)
committerGitHub <noreply@github.com>
Thu, 23 Jan 2025 17:55:28 +0000 (17:55 +0000)
gh-128330: Terminal control characters should be restored on repl exit (GH-128331)
(cherry picked from commit 0b15d9c0d2d30c7d3f17ebb90dd822ef32f977cc)

Co-authored-by: Andy Fiddaman <andy@omnios.org>
Lib/_pyrepl/fancy_termios.py
Misc/NEWS.d/next/Core_and_Builtins/2024-12-29-15-09-21.gh-issue-128330.IaYL7G.rst [new file with mode: 0644]

index 5b85cb0f52521f52d1f35ca5bb4b06f7bdcc7933..0468b9a267026737b2fdf9597b351ea8d89b0c9e 100644 (file)
@@ -40,7 +40,9 @@ class TermState:
             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 (file)
index 0000000..8fe628d
--- /dev/null
@@ -0,0 +1 @@
+Restore terminal control characters on REPL exit.