]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-132017: Handle SIGCONT in `pyrepl` (#132918)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Mon, 5 May 2025 20:37:01 +0000 (21:37 +0100)
committerGitHub <noreply@github.com>
Mon, 5 May 2025 20:37:01 +0000 (20:37 +0000)
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 07b160d23246df6eedf4c99dbc63b020666d43f8..9be6ce6d8632fdeac2ade6265e690fe2c32da0d3 100644 (file)
@@ -197,6 +197,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 __read(self, n: int) -> bytes:
         return os.read(self.input_fd, n)
 
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.