https://github.com/python/cpython/commit/e4561da886717ddd01ab0970452a14a1531e874d
commit: e4561da886717ddd01ab0970452a14a1531e874d
branch: main
author: Stan Ulbrych <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-05-05T20:37:01Z
summary:
gh-132017: Handle SIGCONT in `pyrepl` (#132918)
files:
A Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst
M Lib/_pyrepl/unix_console.py
diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py
index 07b160d23246df..9be6ce6d8632fd 100644
--- a/Lib/_pyrepl/unix_console.py
+++ b/Lib/_pyrepl/unix_console.py
@@ -197,6 +197,12 @@ def _my_getstr(cap: str, optional: bool = False) -> bytes
| None:
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
index 00000000000000..a11ccb9e07e01a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst
@@ -0,0 +1 @@
+Fix error when ``pyrepl`` is suspended, then resumed and terminated.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]