summaryrefslogtreecommitdiff
path: root/Modules/_zoneinfo.c
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2021-01-27 01:16:20 -0700
committerGitHub <noreply@github.com>2021-01-27 10:16:20 +0200
commit5327f370344a627f1578d8183d197feb286371c6 (patch)
tree675f71f86e45a666032875fc74877836625c6b14 /Modules/_zoneinfo.c
parent7a34380ad788886f5ad50d4175ceb2d5715b8cff (diff)
downloadcpython-git-5327f370344a627f1578d8183d197feb286371c6.tar.gz
bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345)
Diffstat (limited to 'Modules/_zoneinfo.c')
-rw-r--r--Modules/_zoneinfo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c
index d1e09340d1..4a4cbdbee3 100644
--- a/Modules/_zoneinfo.c
+++ b/Modules/_zoneinfo.c
@@ -2525,7 +2525,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;
}