]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (GH-12166...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 14 Jul 2024 11:37:00 +0000 (13:37 +0200)
committerGitHub <noreply@github.com>
Sun, 14 Jul 2024 11:37:00 +0000 (11:37 +0000)
gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (GH-121661)
(cherry picked from commit bb802db8cfa35a88582be32fae05fe1cf8f237b1)

Co-authored-by: sobolevn <mail@sobolevn.me>
Objects/genericaliasobject.c

index 117b4e8dfb960ae17c80b970a7714b25def62ad3..7f89e68340b66fbba4ad5233e5df813b96764d67 100644 (file)
@@ -564,6 +564,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);