mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raising
new exception with setting current exception as __cause__. _PyErr_FormatFromCause(exception, format, args...) is equivalent to Python raise exception(format % args) from sys.exc_info()[1]
This commit is contained in:
parent
b0426cd8c4
commit
467ab194fc
7 changed files with 70 additions and 53 deletions
|
@ -255,6 +255,17 @@ PyAPI_FUNC(PyObject *) PyErr_FormatV(
|
|||
va_list vargs);
|
||||
#endif
|
||||
|
||||
#ifndef Py_LIMITED_API
|
||||
/* Like PyErr_Format(), but saves current exception as __context__ and
|
||||
__cause__.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(
|
||||
PyObject *exception,
|
||||
const char *format, /* ASCII-encoded string */
|
||||
...
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
|
||||
int ierr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue