mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
This commit is contained in:
parent
a9a9dab042
commit
cb41cda8e3
1 changed files with 11 additions and 1 deletions
|
@ -172,6 +172,7 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import sysconfig
|
import sysconfig
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -266,9 +267,18 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
|
||||||
on the command line.
|
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)
|
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()
|
replace_stdout()
|
||||||
|
|
||||||
support.record_original_stdout(sys.stdout)
|
support.record_original_stdout(sys.stdout)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue