This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients BreamoreBoy, Rhamphoryncus, belopolsky, docs@python, eric.araujo, georg.brandl, gvanrossum, poolie, schmir, tebeka, terry.reedy, vstinner
Date 2011-08-30.21:56:02
SpamBayes Score 0.00928361
Marked as misclassified No
Message-id <1314741363.51.0.771027280396.issue1215@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.

See faulthandler_fatal_error() function:
https://github.com/haypo/faulthandler/blob/master/faulthandler.c#L257

> 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:
http://pypi.python.org/pypi/faulthandler

> 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:
http://docs.python.org/dev/library/faulthandler.html
History
Date User Action Args
2011-08-30 21:56:03vstinnersetrecipients: + vstinner, gvanrossum, georg.brandl, terry.reedy, tebeka, belopolsky, Rhamphoryncus, schmir, eric.araujo, docs@python, BreamoreBoy, poolie
2011-08-30 21:56:03vstinnersetmessageid: <1314741363.51.0.771027280396.issue1215@psf.upfronthosting.co.za>
2011-08-30 21:56:02vstinnerlinkissue1215 messages
2011-08-30 21:56:02vstinnercreate