[Python-Dev] Fault handler updated, now disabled by default (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Mon Dec 27 01:07:50 CET 2010


On Mon, Dec 27, 2010 at 8:57 AM, Victor Stinner <victor.stinner at haypocalc.com> wrote:

Le dimanche 26 décembre 2010 à 14:10 +0000, exarkun at twistedmatrix.com a écrit :

On 25 Dec, 10:31 pm, merwok at netwok.org wrote: >>faulthandler is a module: enable the handler is simple as "import >>faulthandler". > >That sounds like a source of unwanted behavior (aka problems) if the >handler is enabled by  1Cpydoc faulthandler 1D or by a pkgutil walk.  You >may want to consider using a function to enable the functionality (and >add one to disable it).

Enormous +1. I don't know pkgutil. How does it work? In which case would it load the faulthandler module? faulthandler is currently only written in C.

pkgutil includes a function that lets you walk the entire module heirarchy, implicitly importing everything, including all the builtin modules. It's one of the reasons doing things as side-effects of import is considered highly undesirable.

The pydoc tests do this when they bring the (docstring-based) documentation server up to check its handling of HTTP requests. (we recently picked up an implicit addition of a logging handler by concurrent.futures due to this effect).

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list