mirror of
https://github.com/python/cpython.git
synced 2025-11-08 17:41:42 +00:00
gh-139391: properly handle signal.signal() in UnixConsole when called from a non-main thread (#139392)
This commit is contained in:
parent
81959a0364
commit
b8c8b8f1d3
3 changed files with 22 additions and 2 deletions
|
|
@ -390,7 +390,12 @@ def restore(self):
|
|||
os.write(self.output_fd, b"\033[?7h")
|
||||
|
||||
if hasattr(self, "old_sigwinch"):
|
||||
signal.signal(signal.SIGWINCH, self.old_sigwinch)
|
||||
try:
|
||||
signal.signal(signal.SIGWINCH, self.old_sigwinch)
|
||||
except ValueError as e:
|
||||
import threading
|
||||
if threading.current_thread() is threading.main_thread():
|
||||
raise e
|
||||
del self.old_sigwinch
|
||||
|
||||
def push_char(self, char: int | bytes) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue