https://github.com/python/cpython/commit/0ca5390b6089035490861dedd6514f878fe291b6
commit: 0ca5390b6089035490861dedd6514f878fe291b6
branch: 3.13
author: Prakash Sellathurai <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-04-18T07:54:21-07:00
summary:

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

(cherry picked from commit 634568d030f18183212c01bd4544aa7f97e05442)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2026-04-07-20-37-23.gh-issue-148222.uF4D4E.rst
M 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
index 00000000000000..2c273fc4daba3d
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-07-20-37-23.gh-issue-148222.uF4D4E.rst
@@ -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.
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 8e59b3884cf529..30759ca0e0eb67 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -278,7 +278,6 @@ _Py_make_parameters(PyObject *args)
                     len += needed;
                     if (_PyTuple_Resize(&parameters, len) < 0) {
                         Py_DECREF(subparams);
-                        Py_DECREF(parameters);
                         return NULL;
                     }
                 }
@@ -636,7 +635,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);
 }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to