]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-132017: Handle SIGCONT in `pyrepl` (#132918) (#133470)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Mon, 5 May 2025 21:13:08 +0000 (22:13 +0100)
committerGitHub <noreply@github.com>
Mon, 5 May 2025 21:13:08 +0000 (23:13 +0200)
Lib/_pyrepl/unix_console.py
Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst [new file with mode: 0644]

index e69c96b11598aaa51cccbc1b8bee81f34c54dbbb..5b0c2fef92c0f00f5dca20980fb8d5386621fcff 100644 (file)
@@ -199,6 +199,12 @@ class UnixConsole(Console):
         self.event_queue = EventQueue(self.input_fd, self.encoding)
         self.cursor_visible = 1
 
+        signal.signal(signal.SIGCONT, self._sigcont_handler)
+
+    def _sigcont_handler(self, signum, frame):
+        self.restore()
+        self.prepare()
+
     def more_in_buffer(self) -> bool:
         return bool(
             self.input_buffer
diff --git a/Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst b/Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst
new file mode 100644 (file)
index 0000000..a11ccb9
--- /dev/null
@@ -0,0 +1 @@
+Fix error when ``pyrepl`` is suspended, then resumed and terminated.