diff --git a/Objects/setobject.c b/Objects/setobject.c index a762edf5933e18..8c5f244d4894d8 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1348,19 +1348,20 @@ static PyObject * make_new_set_untracked(PyTypeObject *type, PyObject *iterable) { assert(PyType_Check(type)); - PySetObject *so; - so = (PySetObject *)_PyType_AllocNoTrack(type, 0); - if (so == NULL) + // fields are zero-initialized by _PyType_AllocNoTrack + PySetObject *so = (PySetObject *)_PyType_AllocNoTrack(type, 0); + if (so == NULL) { return NULL; + } - so->fill = 0; - so->used = 0; + assert(so->fill == 0); + assert(so->used == 0); so->mask = PySet_MINSIZE - 1; so->table = so->smalltable; so->hash = -1; - so->finger = 0; - so->weakreflist = NULL; + assert(so->finger == 0); + assert(so->weakreflist == NULL); if (iterable != NULL) { if (set_update_local(so, iterable)) {