diff options
author | sobolevn <mail@sobolevn.me> | 2024-07-14 11:20:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-14 11:20:40 (GMT) |
commit | bb802db8cfa35a88582be32fae05fe1cf8f237b1 (patch) | |
tree | 5f6ad966edebf4defce9bb17ed47bd4605b2e90d | |
parent | 6505bda85a3b11c9012707896b0c3dee8a3855cb (diff) | |
download | cpython-bb802db8cfa35a88582be32fae05fe1cf8f237b1.zip cpython-bb802db8cfa35a88582be32fae05fe1cf8f237b1.tar.gz cpython-bb802db8cfa35a88582be32fae05fe1cf8f237b1.tar.bz2 |
gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (#121661)
-rw-r--r-- | Objects/genericaliasobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index f5fefd6..96c9649 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); |