]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341) (#154342)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 21 Jul 2026 10:56:35 +0000 (12:56 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2026 10:56:35 +0000 (10:56 +0000)
gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341)
(cherry picked from commit 196e16d54f9f06f566c52e7bca3b5213a8a64223)

Co-authored-by: sobolevn <mail@sobolevn.me>
Objects/genericaliasobject.c

index 5caf5c7086c87a0ce4b767521a2a1b61d6585b86..71d946a637df1c913f857c4ac0c307c0b4fad5e1 100644 (file)
@@ -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++) {