[issue23188] Provide a C helper function to chain raised (but not yet caught) exceptions

Serhiy Storchaka report at bugs.python.org
Tue May 22 13:44:16 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

There is usually more complex code between PyErr_Fetch() and _PyErr_ChainExceptions():

        PyObject *exc, *val, *tb, *close_result;
        PyErr_Fetch(&exc, &val, &tb);
        close_result = _PyObject_CallMethodId(result, &PyId_close, NULL);
        _PyErr_ChainExceptions(exc, val, tb);
        Py_XDECREF(close_result);

Many exceptions can be raised and silenced or overridden between, but we are interesting in chaining the only latest exception (or restoring the original exception if all exceptions between were silenced).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue23188>
_______________________________________


More information about the Python-bugs-list mailing list