Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb41cda

Browse files
author
Victor Stinner
committed
Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
1 parent a9a9dab commit cb41cda

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Lib/test/regrtest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
import platform
173173
import random
174174
import re
175+
import signal
175176
import sys
176177
import sysconfig
177178
import tempfile
@@ -266,9 +267,18 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
266267
on the command line.
267268
"""
268269

269-
# Display the Python traceback fatal errors (e.g. segfault)
270+
# Display the Python traceback on fatal errors (e.g. segfault)
270271
faulthandler.enable(all_threads=True)
271272

273+
# Display the Python traceback on SIGALRM or SIGUSR1 signal
274+
signals = []
275+
if hasattr(signal, 'SIGALRM'):
276+
signals.append(signal.SIGALRM)
277+
if hasattr(signal, 'SIGUSR1'):
278+
signals.append(signal.SIGUSR1)
279+
for signum in signals:
280+
faulthandler.register(signum, chain=True)
281+
272282
replace_stdout()
273283

274284
support.record_original_stdout(sys.stdout)

0 commit comments

Comments
 (0)