gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (#121661)

This commit is contained in:
sobolevn 2024-07-14 14:20:40 +03:00 committed by GitHub
parent 6505bda85a
commit bb802db8cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -563,6 +563,10 @@ ga_getitem(PyObject *self, PyObject *item)
} }
PyObject *res = Py_GenericAlias(alias->origin, newargs); PyObject *res = Py_GenericAlias(alias->origin, newargs);
if (res == NULL) {
Py_DECREF(newargs);
return NULL;
}
((gaobject *)res)->starred = alias->starred; ((gaobject *)res)->starred = alias->starred;
Py_DECREF(newargs); Py_DECREF(newargs);