[Python-Dev] cpython: Issue #12550: regrtest displays the Python traceback on SIGALRM or SIGUSR1

Georg Brandl g.brandl at gmx.net
Thu Jul 14 13:33:32 CEST 2011


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 at 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 at python.org
> http://mail.python.org/mailman/listinfo/python-checkins




More information about the Python-Dev mailing list