Commit 620580f2 authored by Victor Stinner's avatar Victor Stinner

Fix refleaks if Py_EnterRecursiveCall() fails

Issue #29306: Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails.
parent 17a63e21
......@@ -2350,14 +2350,15 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs,
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
Py_DECREF(argstuple);
return NULL;
}
result = (*call)(callable, argstuple, kwargs);
Py_LeaveRecursiveCall();
Py_DECREF(argstuple);
result = _Py_CheckFunctionResult(callable, result, NULL);
return result;
}
......@@ -2544,6 +2545,8 @@ _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t narg
}
if (Py_EnterRecursiveCall(" while calling a Python object")) {
Py_DECREF(argstuple);
Py_XDECREF(kwdict);
return NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment