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

(cherry picked from commit 5327f37034)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
This commit is contained in:
Miss Islington (bot) 2021-01-27 01:40:31 -08:00 committed by GitHub
parent 68102fb998
commit cb77c5e1dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2530,7 +2530,11 @@ zoneinfo_init_subclass(PyTypeObject *cls, PyObject *args, PyObject **kwargs)
return NULL; 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_DECREF(weak_cache);
Py_RETURN_NONE; Py_RETURN_NONE;
} }