[Python-Dev] Fault handler updated, now disabled by default
victor.stinner at haypocalc.com
Sat Dec 25 22:58:00 CET 2010
Le vendredi 24 décembre 2010 à 12:59 +0000, Michael Foord a écrit :
> I hope you will include it in 3.3 though; it is great functionality.
I don't know, Python 3.3 is not planned yet. Anyway, faulthandler is
already available and you can use it on Python 2.5 through 3.2.
> I would really like to see it enabled by default as well.
For different reasons, it is not a good idea to enable it by default
(see the recent discussion on this list).
> It seemed from the discussion that the biggest barrier to enabling it by
> default was possible difficulties when ...
Yes, that's why it was disabled by default in the latest version of my
> (multiple interpreters,
I think that my fault handler works with multiple interpreters.
> potential conflicts with application signal handling)
Very few programs have an handler for SIGSEGV, SIGFPE, SIGILL or SIGBUS
signals (but yes, there are such programs/libraries like RPy or XEmacs).
> A public C-API to disable the functionality per interpreter would be one
> option for this. Another possibility would be providing a C-API to
> enable it and have the Python interpreter application call this, so that
> the functionality remains off by default for embedded interpreters but
> on for normal uses.
I think that it's better to disable it by default, and only enabled by
the user or by the developer of a specific application.
Anyway, you don't have to wait Python 3.3 (or Python 3.2): you can
already use faulthandler ;-) I created Windows installer for Python 2.6,
2.7 and 3.1 (I will do it for 2.5 too in the next faulthandler version,
faulthandler 1.0 tests don't work with Python 2.5).
faulthandler is a module: enable the handler is simple as "import
faulthandler". Said differently, it's also disabled by default, and only
enabled by the application developer. It's harder to enable it for the
user, the site module should maybe be patched to load the module if an
environment variable exist or a command line argument.
More information about the Python-Dev