[Python-Dev] Integrate the faulthandler module into Python 3.3?

Scott Dial scott+python-dev at scottdial.com
Fri Mar 4 12:32:17 CET 2011


On 3/4/2011 6:10 AM, Nick Coghlan wrote:
> On Fri, Mar 4, 2011 at 10:58 AM, Victor Stinner
> <victor.stinner at haypocalc.com> wrote:
>> So, what do you think?
> 
> Something we may want to consider is enabling it by default in
> interactive mode, and also when `-i` is specified on the command line.

I am still bothered by the fact that,

>>> import faulthandler
>>> faulthandler.enable()
>>> import sys
>>> sys.stderr.close()
>>> sys.stderr = open('logs/error.log', 'wb')
>>> faulthandler.sigsegv()

, does the wrong thing. In this incantation, it's easy to say that it's
programmer error, but I think this still precludes it from being on by
default (where the first two statement are implicitly executed by the
interpreter). It's probably uncommon enough to close stderr from an
interactive interpreter session that it doesn't bother me (although I am
not sure the utility of that), but I would hesitate to say that is true
for using '-i'.

Otherwise, the functionality seems generally useful and it's on my list
of things to integrate into my application, and having it in the stdlib
is one less external dependency for me to manage.

-Scott

-- 
Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu


More information about the Python-Dev mailing list