8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37965d2 commit 3289209Copy full SHA for 3289209
Python/errors.c
@@ -520,9 +520,7 @@ PyErr_GetHandledException(void)
520
void
521
_PyErr_SetHandledException(PyThreadState *tstate, PyObject *exc)
522
{
523
- PyObject *oldexc = tstate->exc_info->exc_value;
524
- tstate->exc_info->exc_value = Py_XNewRef(exc);
525
- Py_XDECREF(oldexc);
+ Py_XSETREF(tstate->exc_info->exc_value, Py_XNewRef(exc));
526
}
527
528
@@ -543,6 +541,7 @@ void
543
541
PyErr_SetExcInfo(PyObject *type, PyObject *value, PyObject *traceback)
544
542
545
PyErr_SetHandledException(value);
+ Py_XDECREF(value);
546
/* These args are no longer used, but we still need to steal a ref */
547
Py_XDECREF(type);
548
Py_XDECREF(traceback);
0 commit comments