[Python-Dev] bpo-36829: Add sys.unraisablehook()

Nathaniel Smith njs at pobox.com
Thu May 16 15:29:00 EDT 2019

On Thu, May 16, 2019, 09:07 Steve Dower <steve.dower at python.org> wrote:

> Actually, if the default implementation prints the exception message,
> how is this different from sys.excepthook? Specifically, from the point
> of customizing the hooks.

sys.excepthook means the program has fully unwound and is about to exit.
This is pretty different from an exception inside a __del__ or background
thread or whatever, where the program definitely hasn't unwound and is
likely to continue. And I'm pretty sure they have behavioral differences
already, like if you pass in a SystemExit exception then sys.excepthook
doesn't print anything, but PyErr_WriteUnraiseable prints a traceback.

So making them two separate hooks seems right to me. Some people will
override both; that's fine.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190516/059f443b/attachment-0001.html>

More information about the Python-Dev mailing list