[3.15] gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341) (#154342)

sobolevn <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/b3e046cdb4e9ac869b77022579d47ddb848c4fda
commit: b3e046cdb4e9ac869b77022579d47ddb848c4fda
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: sobolevn <[email protected]>
date: 2026-07-21T10:56:35Z
summary:

[3.15] gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341) (#154342)

gh-154275: Fix cleanup code in `_Py_make_parameters` (GH-154341)
(cherry picked from commit 196e16d54f9f06f566c52e7bca3b5213a8a64223)

Co-authored-by: sobolevn <[email protected]>

files:
M Objects/genericaliasobject.c

diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 5caf5c7086c87a..71d946a637df1c 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++) {

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.