[Python-Dev] Issue #8863 adds a new PYTHONNOFAULTHANDLER environment variable

Georg Brandl g.brandl at gmx.net
Sat Dec 18 13:21:45 CET 2010

Am 18.12.2010 01:55, schrieb Victor Stinner:
> Hi,
> In 2008, I proposed a patch to raise a Python exception on SIGSEVG 
> signal. In some cases, it's possible to catch the exception, log it, and 
> continue the execution. But because in some cases, the Python internal 
> state is corrupted, the idea was rejected (see the issue #3999).
> Someone asked me to display the Python backtrace on SIGSEGV, instead of 
> raising an exception. I implemented this idea in issue #8863. After 9 
> versions, I think that the patch is ready for inclusion. It catchs 
> SIGSEGV, SIGFPE, SIGBUS and SIGILL signals, and also display the Python 
> backtrace on fatal errors. Because some operating systems have their own 
> fault handler (eg. Ubuntu with apport), Dave Malcolm asked me to add an 
> option disable the Python handler. That's why I added the 
> PYTHONNOFAULTHANDLER environment variable (we all love long variable 
> names!). For an OS vendor, it looks like an environment variable is more 
> practical than a command line option. Eg. Mandriva sets 
> PYTHONDONTWRITEBYTECODE for the whole system.
> Raymond Hettinger asked me on IRC to write an email about the new 
> environment variable, so here is the question: do you agree to add the 
> new variable?

I very much like having a traceback on (some) segmentation faults, but
it's clear there needs to be a way to turn it off.  An environment variable
seems to be the obvious choice (for the reasons you stated for


More information about the Python-Dev mailing list