Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

As the original author of _PyErr_ChainExceptions() (issue21715) I am not sure 
that its name and signature are optimal. It did not matter while it was 
internal function because we could change them at any moment, but for public 
API the design should be more thoughtful.

Is passing three arguments convenient enough? Would not be better to pass them 
as a single argument like in _PyErr_ChainStackItem()? Is the function name 
good? Should we provide several similar functions for setting __context__, 
__cause__ and both?

There are other, more specialized, helpers: _PyErr_FormatFromCause() and 
_PyErr_TrySetFromCause().

There are also some flaws in setting __context__ and __cause__ (see 
issue39725). Perhaps we will design better concept of chaining exceptions in 
future.

----------
components: +C API
nosy: +serhiy.storchaka
type:  -> enhancement
versions: +Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44938>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to