[3.14] gh-148222: Fix NULL dereference bugs in genericaliasobject.c (GH-148226) (#148705)

gh-148222: Fix NULL dereference bugs in genericaliasobject.c (GH-148226)
(cherry picked from commit 634568d030)

Co-authored-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
This commit is contained in:
Miss Islington (bot)
2026-04-18 02:47:06 +02:00
committed by GitHub
parent 7f6a0c377b
commit 67100b3e92
2 changed files with 2 additions and 2 deletions
@@ -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.
+1 -2
View 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;
}
@@ -647,7 +646,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);
}