diff --git a/Objects/exceptions.c b/Objects/exceptions.c index c6af82a4668550..3c4df2facfe2e2 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -1114,6 +1114,7 @@ exceptiongroup_split_recursive(PyObject *exc, assert(PyList_CheckExact(match_list)); if (PyList_Append(match_list, rec_result.match) < 0) { Py_DECREF(rec_result.match); + Py_XDECREF(rec_result.rest); goto done; } Py_DECREF(rec_result.match);