]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-148222: Fix NULL dereference bugs in genericaliasobject.c (#148226)
authorPrakash Sellathurai <prakashsellathurai@gmail.com>
Sat, 18 Apr 2026 00:21:13 +0000 (05:51 +0530)
committerGitHub <noreply@github.com>
Sat, 18 Apr 2026 00:21:13 +0000 (17:21 -0700)
Misc/NEWS.d/next/Core_and_Builtins/2026-04-07-20-37-23.gh-issue-148222.uF4D4E.rst [new file with mode: 0644]
Objects/genericaliasobject.c

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-07-20-37-23.gh-issue-148222.uF4D4E.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-07-20-37-23.gh-issue-148222.uF4D4E.rst
new file mode 100644 (file)
index 0000000..2c273fc
--- /dev/null
@@ -0,0 +1 @@
+Fix vectorcall support in :class:`types.GenericAlias` when the underlying type does not support the vectorcall protocol. Fix possible leaks in :class:`types.GenericAlias` and :class:`types.UnionType` in case of memory error.
index 7aef56cf4e93b8f8ee2266e586d3de982761351b..e3bc8eb2739e3fa51e3275e85776a20074e33a84 100644 (file)
@@ -242,7 +242,6 @@ _Py_make_parameters(PyObject *args)
                     len += needed;
                     if (_PyTuple_Resize(&parameters, len) < 0) {
                         Py_DECREF(subparams);
-                        Py_DECREF(parameters);
                         Py_XDECREF(tuple_args);
                         return NULL;
                     }
@@ -650,7 +649,7 @@ ga_vectorcall(PyObject *self, PyObject *const *args,
               size_t nargsf, PyObject *kwnames)
 {
     gaobject *alias = (gaobject *) self;
-    PyObject *obj = PyVectorcall_Function(alias->origin)(alias->origin, args, nargsf, kwnames);
+    PyObject *obj = PyObject_Vectorcall(alias->origin, args, nargsf, kwnames);
     return set_orig_class(obj, self);
 }