]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (#121661)
authorsobolevn <mail@sobolevn.me>
Sun, 14 Jul 2024 11:20:40 +0000 (14:20 +0300)
committerGitHub <noreply@github.com>
Sun, 14 Jul 2024 11:20:40 +0000 (14:20 +0300)
Objects/genericaliasobject.c

index f5fefd656539c85b7368fa4ccf2853bb3f24bd9f..96c96491501a2cb0a518244fb0b961dc08c8167d 100644 (file)
@@ -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);