mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Close #20105: set __traceback__ when chaining exceptions in C
This commit is contained in:
parent
23e37aa7b7
commit
77b286b2cc
5 changed files with 27 additions and 2 deletions
|
@ -2689,8 +2689,11 @@ _PyErr_TrySetFromCause(const char *format, ...)
|
|||
* types as well, but that's quite a bit trickier due to the extra
|
||||
* state potentially stored on OSError instances.
|
||||
*/
|
||||
|
||||
Py_XDECREF(tb);
|
||||
/* Ensure the traceback is set correctly on the existing exception */
|
||||
if (tb != NULL) {
|
||||
PyException_SetTraceback(val, tb);
|
||||
Py_DECREF(tb);
|
||||
}
|
||||
|
||||
#ifdef HAVE_STDARG_PROTOTYPES
|
||||
va_start(vargs, format);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue