summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-01-27 09:40:31 (GMT)
committerGitHub <noreply@github.com>2021-01-27 09:40:31 (GMT)
commitcb77c5e1ddd9328e4706f8fdf893aa6bf697942c (patch)
treeea097e2daf93247258ad745e6d6531f576492261
parent68102fb9987338a70d69a0162917866e5710458d (diff)
downloadcpython-cb77c5e1ddd9328e4706f8fdf893aa6bf697942c.zip
cpython-cb77c5e1ddd9328e4706f8fdf893aa6bf697942c.tar.gz
cpython-cb77c5e1ddd9328e4706f8fdf893aa6bf697942c.tar.bz2
bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345) (GH-24349)
(cherry picked from commit 5327f370344a627f1578d8183d197feb286371c6) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
-rw-r--r--Modules/_zoneinfo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index d87a201..0913860 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -2530,7 +2530,11 @@ zoneinfo_init_subclass(PyTypeObject *cls, PyObject *args, PyObject **kwargs)
return NULL;
}
- PyObject_SetAttrString((PyObject *)cls, "_weak_cache", weak_cache);
+ if (PyObject_SetAttrString((PyObject *)cls, "_weak_cache",
+ weak_cache) < 0) {
+ Py_DECREF(weak_cache);
+ return NULL;
+ }
Py_DECREF(weak_cache);
Py_RETURN_NONE;
}