gh-130595: Fix leak in WITH_EXCEPT_START error case (GH-130626)

Co-authored-by: Ken Jin <kenjin@python.org>
This commit is contained in:
Petr Viktorin 2025-02-28 09:58:50 +01:00 committed by GitHub
parent 24c52cb14c
commit fecf8bc8f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 7 deletions

View file

@ -3317,8 +3317,8 @@ dummy_func(
int has_self = !PyStackRef_IsNull(exit_self);
PyObject *res_o = PyObject_Vectorcall(exit_func_o, stack + 2 - has_self,
(3 + has_self) | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
ERROR_IF(res_o == NULL, error);
Py_XDECREF(original_tb);
ERROR_IF(res_o == NULL, error);
res = PyStackRef_FromPyObjectSteal(res_o);
}