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

Serhiy Storchaka storchaka at gmail.com
Thu May 16 06:54:04 EDT 2019


16.05.19 13:12, Victor Stinner пише:
> I came to the UnraisableHookArgs structseq idea because of my bad
> experience with extension warnings "hooks". Let me tell you this story
> :-)

I know this story, because I followed these issues.

> For unraisable hook, it's not hard to imagine other useful parameters
> that can be passed to the hook to provide more context about the
> exception. For example, right now we only pass one object. But there
> are cases where a second object would totally makes sense.

If you have plans for adding new details in future, I propose to add a 
6th parameter "context" or "extra" (always None currently). It is as 
extensible as packing all arguments into a single structure, but you do 
not need to introduce the structure type and create its instance until 
you need to pass additional info.



More information about the Python-Dev mailing list