Re: [Python-Dev] cpython: Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
Would it make sense to not propagate the signal in one case (e.g. SIGUSR1), i.e. just display the traceback in this case? Georg Am 13.07.2011 23:49, schrieb victor.stinner:
http://hg.python.org/cpython/rev/30f91fbfc8b3 changeset: 71315:30f91fbfc8b3 user: Victor Stinner <victor.stinner@haypocalc.com> date: Wed Jul 13 23:47:21 2011 +0200 summary: Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1
files: Lib/test/regrtest.py | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -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)
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
Le 14/07/2011 13:33, Georg Brandl a écrit :
Would it make sense to not propagate the signal in one case (e.g. SIGUSR1), i.e. just display the traceback in this case?
I opened this issue for buildbots. If the test suite doesn't fail anymore because of a SIGALRM or SIGUSR1, we may miss a bug in a test, or a real bug in a module. I don't think that anyone will read the output of all builds. I patched faulthandler for this issue: I added a chain argument to faulthandler.register() to call also the previous signal handler. I prefer to call the original signal handler to not change the current behaviour of the test suite. Victor
participants (2)
-
Georg Brandl -
Victor Stinner