Skip to content

Commit 7a4b55d

Browse files
[3.12] gh-121660: Fix ga_getitem by explicitly checking for NULL result (GH-121661) (#121762)
gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (GH-121661) (cherry picked from commit bb802db) Co-authored-by: sobolevn <[email protected]>
1 parent 004758e commit 7a4b55d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Objects/genericaliasobject.c

+4
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ ga_getitem(PyObject *self, PyObject *item)
564564
}
565565

566566
PyObject *res = Py_GenericAlias(alias->origin, newargs);
567+
if (res == NULL) {
568+
Py_DECREF(newargs);
569+
return NULL;
570+
}
567571
((gaobject *)res)->starred = alias->starred;
568572

569573
Py_DECREF(newargs);

0 commit comments

Comments
 (0)