[Python-Dev] Trap SIGSEGV and SIGFPE

Adam Olsen rhamph at gmail.com
Wed Dec 10 19:14:30 CET 2008

On Wed, Dec 10, 2008 at 4:06 AM, Victor Stinner
<victor.stinner at haypocalc.com> wrote:
> Hi,
> I published a new version of my fault handler: it installs an handler for
> signals SIGFPE and SIGSEGV. Using it, it's possible to catch them and
> continue the execution of your Python program. Example:

This will of course leave the program in an undefined state.  It is
very likely to crash again, emit garbage, hang, or otherwise be

sigsetjmp() is only safe for code explicitly designed for it.  That
will never be the case for CPython, let alone all the arbitrary
libraries that may be used with it.

Adam Olsen, aka Rhamphoryncus

More information about the Python-Dev mailing list