Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Lib/test/libregrtest/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def setup_process() -> None:
for signum in signals:
faulthandler.register(signum, chain=True, file=stderr_fd)

# Restore the default SIGINT handler if there is no Python-level
# handler. Python inherits the SIG_IGN disposition when the test
# suite runs as a shell background job; then asyncio.Runner does not
# install its own handler and _thread.interrupt_main() is a no-op,
# which makes some tests in test_asyncio and test_threading hang.
if signal.getsignal(signal.SIGINT) in (signal.SIG_IGN, signal.SIG_DFL):
signal.signal(signal.SIGINT, signal.default_int_handler)

adjust_rlimit_nofile()

support.record_original_stdout(sys.stdout)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The test runner (regrtest) now restores the default SIGINT handler if it
was inherited as ignored, so the test suite no longer hangs when run as
a shell background job.
Loading