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

Serhiy Storchaka report at bugs.python.org
Wed Oct 19 04:23:27 EDT 2016


Serhiy Storchaka added the comment:

This helper is convenient in many cases, but it is very limited. It raises an exception with single string argument. It doesn't work in cases when the exception doesn't take arguments (PyErr_SetNone) or takes multiple or non-string arguments (PyErr_SetFromErrnoWithFilenameObject, PyErr_SetImportError). I think for public API we need more general solution. Something like this:

    PyObject *cause = get_current_exception();
    PyErr_SetImportError(msg, name, path);
    set_cause_of_current_exception(cause);

----------

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


More information about the Python-bugs-list mailing list