From: sobolevn Date: Sun, 14 Jul 2024 11:20:40 +0000 (+0300) Subject: gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (#121661) X-Git-Tag: v3.14.0a1~1138 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb802db8cfa35a88582be32fae05fe1cf8f237b1;p=thirdparty%2FPython%2Fcpython.git gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (#121661) --- diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index f5fefd656539..96c96491501a 100644 --- a/Objects/genericaliasobject.c +++ b/Objects/genericaliasobject.c @@ -563,6 +563,10 @@ ga_getitem(PyObject *self, PyObject *item) } PyObject *res = Py_GenericAlias(alias->origin, newargs); + if (res == NULL) { + Py_DECREF(newargs); + return NULL; + } ((gaobject *)res)->starred = alias->starred; Py_DECREF(newargs);