From d8ded0e59c4ce92b610c3525cab62e9352b91939 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 21 Jul 2026 12:49:51 +0300 Subject: [PATCH] gh-154275: Fix cleanup code in `_Py_make_parameters` --- Objects/genericaliasobject.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index 5caf5c7086c87a0..71d946a637df1c9 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -195,15 +195,14 @@ _Py_make_parameters(PyObject *args) if (is_args_list) { args = tuple_args = PySequence_Tuple(args); if (args == NULL) { - return NULL; + goto cleanup; } } Py_ssize_t nargs = PyTuple_GET_SIZE(args); Py_ssize_t len = nargs; PyObject *parameters = PyTuple_New(len); if (parameters == NULL) { - Py_XDECREF(tuple_args); - return NULL; + goto error; } Py_ssize_t iparam = 0; for (Py_ssize_t iarg = 0; iarg < nargs; iarg++) {