Skip to content

Commit 634568d

Browse files
gh-148222: Fix NULL dereference bugs in genericaliasobject.c (#148226)
1 parent db3e990 commit 634568d

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
}
@@ -650,7 +649,7 @@ ga_vectorcall(PyObject *self, PyObject *const *args,
650649
size_t nargsf, PyObject *kwnames)
651650
{
652651
gaobject *alias = (gaobject *) self;
653-
PyObject *obj = PyVectorcall_Function(alias->origin)(alias->origin, args, nargsf, kwnames);
652+
PyObject *obj = PyObject_Vectorcall(alias->origin, args, nargsf, kwnames);
654653
return set_orig_class(obj, self);
655654
}
656655

0 commit comments

Comments
 (0)