Skip to content

Commit 67100b3

Browse files
[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 634568d) Co-authored-by: Prakash Sellathurai <prakashsellathurai@gmail.com>
1 parent 7f6a0c3 commit 67100b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

Objects/genericaliasobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ _Py_make_parameters(PyObject *args)
242242
len += needed;
243243
if (_PyTuple_Resize(&parameters, len) < 0) {
244244
Py_DECREF(subparams);
245-
Py_DECREF(parameters);
246245
Py_XDECREF(tuple_args);
247246
return NULL;
248247
}
@@ -647,7 +646,7 @@ ga_vectorcall(PyObject *self, PyObject *const *args,
647646
size_t nargsf, PyObject *kwnames)
648647
{
649648
gaobject *alias = (gaobject *) self;
650-
PyObject *obj = PyVectorcall_Function(alias->origin)(alias->origin, args, nargsf, kwnames);
649+
PyObject *obj = PyObject_Vectorcall(alias->origin, args, nargsf, kwnames);
651650
return set_orig_class(obj, self);
652651
}
653652

0 commit comments

Comments
 (0)