[docs] [issue1215] documentation doesn't say that you can't handle C segfaults from python

Martin Pool report at bugs.python.org
Wed Aug 31 02:52:01 CEST 2011

Martin Pool <mbp at sourcefrog.net> added the comment:

On 31 August 2011 07:56, STINNER Victor <report at bugs.python.org> wrote:
> STINNER Victor <victor.stinner at haypocalc.com> added the comment:
>> def handler(signal, stackframe):
>>     print "OUCH"
>>     stdout.flush()
>>     _exit(1)
> 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.

Well, strictly speaking, it is very hard or impossible to write C code
that's guaranteed to be safe after an unexpected segv too; who knows
what might have caused it.  The odds are probably better that it will work in
in C than in Python.  At any rate I think it's agreed that the
original code is not supported and it's just the docs that need to

So what do you think of
<http://bugs.python.org/file22989/20110822-1525-signal-doc.diff> ?


Python tracker <report at bugs.python.org>

More information about the docs mailing list