Catching a segfault in a Python library

Brian Cole coleb2 at gmail.com
Tue Nov 27 23:51:06 EST 2007


On Nov 25, 1:37 am, Donn Ingle <donn.in... at gmail.com> wrote:
> MrJean1 wrote:
> > Try catching SIGSEGV using the Python signal module
> > <http://docs.python.org/lib/module-signal.html>
> > An example (for SIGALRM) is on the next page
> > <http://docs.python.org/lib/node546.html>
> > However, it may not work since a SIGSEGV fault is pretty much the end
> > of everything

Unfortunately this does not work for SIGSEGV: "Because the C signal
handler always returns, it makes little sense to catch synchronous
errors like SIGFPE or SIGSEGV"

The best approach I have seen for doing this the proper way is a bit
outdated: www.usenix.org/events/usenix01/full_papers/beazley/beazley.pdf
Also, do a Google search for "libwadpy".

This project needs reviving. Once I start full time in January I may
devote some time to this. Also, I have a friend in need of a computer
science senior project who may help.

The general question is why not build this directly into the
interpreter? The interpreter can automatically raise a seg fault
exception when SIGSEGV occurs. Easier said then done, but why not?

-Brian



More information about the Python-list mailing list