From e4561da886717ddd01ab0970452a14a1531e874d Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 5 May 2025 21:37:01 +0100 Subject: [PATCH] gh-132017: Handle SIGCONT in `pyrepl` (#132918) --- Lib/_pyrepl/unix_console.py | 6 ++++++ .../2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst | 1 + 2 files changed, 7 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-04-25-10-51-00.gh-issue-132017.SIGCONT1.rst diff --git a/Lib/_pyrepl/unix_console.py b/Lib/_pyrepl/unix_console.py index 07b160d23246..9be6ce6d8632 100644 --- a/Lib/_pyrepl/unix_console.py +++ b/Lib/_pyrepl/unix_console.py @@ -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 index 000000000000..a11ccb9e07e0 --- /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. -- 2.47.3