changeset: 71315:30f91fbfc8b3 user: Victor Stinner date: Wed Jul 13 23:47:21 2011 +0200 files: Lib/test/regrtest.py description: Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1 diff -r 39873557ff4f -r 30f91fbfc8b3 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Wed Jul 13 23:39:53 2011 +0200 +++ b/Lib/test/regrtest.py Wed Jul 13 23:47:21 2011 +0200 @@ -172,6 +172,7 @@ import platform import random import re +import signal import sys import sysconfig import tempfile @@ -266,9 +267,18 @@ 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)

AltStyle によって変換されたページ (->オリジナル) /