Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue23188> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com