https://github.com/python/cpython/commit/bb802db8cfa35a88582be32fae05fe1cf8f237b1
commit: bb802db8cfa35a88582be32fae05fe1cf8f237b1
branch: main
author: sobolevn <[email protected]>
committer: sobolevn <[email protected]>
date: 2024-07-14T14:20:40+03:00
summary:

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

files:
M Objects/genericaliasobject.c

diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index f5fefd656539c8..96c96491501a2c 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);

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to