[docs] [issue1215] documentation doesn't say that you can't handle C segfaults from python
report at bugs.python.org
Tue Aug 30 23:56:03 CEST 2011
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> def handler(signal, stackframe):
> print "OUCH"
What do you want to do on a SIGSEGV? On a real fault, you cannot rely on Python internal state, you cannot use any Python object. To handle a real SIGSEGV fault, you have to implement a signal handler using only *signal safe* functions.... in C.
See faulthandler_fatal_error() function:
> The documentation for this can now point to the faulthandler module
> (in Python 3).
For your information, faulthandler is available for Python older than 3.3 as a third party module:
> segfault is the following C module:
For tests, you can use ctypes.string_at(0) to read a word from NULL.
faulthandler installs a signal handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals:
Python tracker <report at bugs.python.org>
More information about the docs