]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 13 Jul 2011 21:47:21 +0000 (23:47 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 13 Jul 2011 21:47:21 +0000 (23:47 +0200)
Lib/test/regrtest.py

index 1426c3edbe9ec84c1f2b016881be4b30b4917b64..528f46a18e701aab7cd799fd898f59ff656028b0 100755 (executable)
@@ -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)