mirror of https://github.com/python/cpython.git
Fix refleaks in PyErr_SetHandledException (GH-91627)
This commit is contained in:
parent
37965d2fb4
commit
3289209716
|
@ -520,9 +520,7 @@ PyErr_GetHandledException(void)
|
||||||
void
|
void
|
||||||
_PyErr_SetHandledException(PyThreadState *tstate, PyObject *exc)
|
_PyErr_SetHandledException(PyThreadState *tstate, PyObject *exc)
|
||||||
{
|
{
|
||||||
PyObject *oldexc = tstate->exc_info->exc_value;
|
Py_XSETREF(tstate->exc_info->exc_value, Py_XNewRef(exc));
|
||||||
tstate->exc_info->exc_value = Py_XNewRef(exc);
|
|
||||||
Py_XDECREF(oldexc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -543,6 +541,7 @@ void
|
||||||
PyErr_SetExcInfo(PyObject *type, PyObject *value, PyObject *traceback)
|
PyErr_SetExcInfo(PyObject *type, PyObject *value, PyObject *traceback)
|
||||||
{
|
{
|
||||||
PyErr_SetHandledException(value);
|
PyErr_SetHandledException(value);
|
||||||
|
Py_XDECREF(value);
|
||||||
/* These args are no longer used, but we still need to steal a ref */
|
/* These args are no longer used, but we still need to steal a ref */
|
||||||
Py_XDECREF(type);
|
Py_XDECREF(type);
|
||||||
Py_XDECREF(traceback);
|
Py_XDECREF(traceback);
|
||||||
|
|
Loading…
Reference in New Issue