summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-07-13 21:47:21 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-07-13 21:47:21 (GMT)
commitcb41cda8e302279821433d862dfe80af8eea4597 (patch)
tree6894481bcee3674083a32e8713a19088ad589d05 /Lib/test/regrtest.py
parenta9a9dab042e8311b24a5c333417cc4beff9f4ddc (diff)
downloadcpython-cb41cda8e302279821433d862dfe80af8eea4597.zip
cpython-cb41cda8e302279821433d862dfe80af8eea4597.tar.gz
cpython-cb41cda8e302279821433d862dfe80af8eea4597.tar.bz2
Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 1426c3e..528f46a 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -172,6 +172,7 @@ import os
import platform
import random
import re
+import signal
import sys
import sysconfig
import tempfile
@@ -266,9 +267,18 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
on the command line.
"""
- # Display the Python traceback fatal errors (e.g. segfault)
+ # Display the Python traceback on fatal errors (e.g. segfault)
faulthandler.enable(all_threads=True)
+ # Display the Python traceback on SIGALRM or SIGUSR1 signal
+ signals = []
+ if hasattr(signal, 'SIGALRM'):
+ signals.append(signal.SIGALRM)
+ if hasattr(signal, 'SIGUSR1'):
+ signals.append(signal.SIGUSR1)
+ for signum in signals:
+ faulthandler.register(signum, chain=True)
+
replace_stdout()
support.record_original_stdout(sys.stdout)