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

Steve Dower steve.dower at python.org
Thu May 16 12:12:26 EDT 2019


On 16May2019 0902, Steve Dower 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.
> 
> If I were going to replace unraisablehook to do something on specific 
> exceptions, I'm almost certainly going to replace excepthook as well, 
> no? The only difference is whether there are any try/except blocks in 
> between, and by definition I think the answer is no (in both cases, or 
> we wouldn't have reached the hook).
> 
> Do you have scenarios in mind where you would need these to do different 
> things? And would those be just as well served by a flag on the 
> exception object rather than an entirely separate hook?

Finally, the changes aren't in yet but PEP 578 is accepted, so perhaps 
this could also be satisfied by an audit hook for an exception that's 
about to be ignored?

Cheers,
Steve


More information about the Python-Dev mailing list