[Python-Dev] I plan to push faulthandler into Python 3.3 in one week

Victor Stinner victor.stinner at haypocalc.com
Thu Mar 24 00:49:09 CET 2011


If nobody complains, I plan to push my faulthandler module into Python
3.3 in one week. It's a module to display the Python backtrace on a
segfault, on a user signal or after a timeout.

I opened an issue (#11393) for that, 3 weeks ago, and I already got some
interesting comments. I fixed some bugs and changed the API (function

Even if faulthandler is very specific to CPython, I would like to keep
its original name: faulthandler (and not _faulthandler). I also plan to
maintain the module outside CPython for Python 2.5-3.2.

What is the procedure to add a new module? Just add the code into
Modules and patch setup.py? The module is distributed under the BSD
(2-clause) license.


faulthandler API is simple and small.

Fatal errors:

 * enable()
 * disable()
 * is_enabled()

Dump the traceback after a timeout:

 * dump_traceback_later(delay, repeat=False, 
                        file=sys.stderr, all_threads=False)
 * cancel_dump_traceback_later()

Dump the traceback on a user signal:

 * register(signum, file=sys.stderr, all_threads=False)
 * unregister(signum)

Explicit call to dump the traceback:

 * dump_traceback(file=sys.stderr, all_threads=False)

Read the README file for more information.

I don't know if I chose the best function names :-)


(see also my previous thread on python-dev, "Integrate the faulthandler
module into Python 3.3?")


More information about the Python-Dev mailing list