bpo-43033: Fix the handling of PyObject_SetAttrString() in _zoneinfo.c (GH-24345)

This commit is contained in:
Zackery Spytz 2021-01-27 01:16:20 -07:00 committed by GitHub
parent 7a34380ad7
commit 5327f37034
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}