Skip to content

Commit 7aca63f

Browse files
[3.13] gh-148222: Fix NULL dereference bugs in genericaliasobject.c (#148226)
(cherry picked from commit 634568d)
1 parent 6690865 commit 7aca63f

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
@@ -278,7 +278,6 @@ _Py_make_parameters(PyObject *args)
278278
len += needed;
279279
if (_PyTuple_Resize(&parameters, len) < 0) {
280280
Py_DECREF(subparams);
281-
Py_DECREF(parameters);
282281
return NULL;
283282
}
284283
}
@@ -636,7 +635,7 @@ ga_vectorcall(PyObject *self, PyObject *const *args,
636635
size_t nargsf, PyObject *kwnames)
637636
{
638637
gaobject *alias = (gaobject *) self;
639-
PyObject *obj = PyVectorcall_Function(alias->origin)(alias->origin, args, nargsf, kwnames);
638+
PyObject *obj = PyObject_Vectorcall(alias->origin, args, nargsf, kwnames);
640639
return set_orig_class(obj, self);
641640
}
642641

0 commit comments

Comments
 (0)