[Python-Dev] Trap SIGSEGV and SIGFPE

Daniel Stutzbach daniel at stutzbachenterprises.com
Thu Dec 11 20:39:30 CET 2008

On Thu, Dec 11, 2008 at 12:15 PM, Adam Olsen <rhamph at gmail.com> wrote:

> You have to use the low-level stderr, nothing that invokes Python.
> I'd hate to get a second segfault while printing the first.
> Just think about how indirect refcounting bugs tend to be.  Another
> example is messing up GIL handling.  There's heaps of things for which
> we'd want good stack traces, which can't be done from Python.

+1 on functionality to print a stack trace on a fault
-1 on translating the fault into an exception

I suggest exposing some functions to control the functionality.  Here are
some things the user may wish to control:

1. Disable/enable the functionality altogether
2. Set the file descriptor that the stack trace should be written to
3. Set a file name that should be created and written to instead
4. Specify whether a core dump should be generated
5. Specify a program to run after the stack trace has been printed

#3 combined with #5 would be very useful for automated bug reporting.

For what it's worth, the functionality could be implemented under Windows
using Structured Exception Handling.

Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20081211/b928db72/attachment.htm>

More information about the Python-Dev mailing list