Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ set_zero_table(setentry *table, size_t size)
#ifdef Py_GIL_DISABLED
for (size_t i = 0; i < size; i++) {
setentry *entry = &table[i];
FT_ATOMIC_STORE_SSIZE_RELAXED(entry->hash, 0);
FT_ATOMIC_STORE_PTR_RELEASE(entry->key, NULL);
FT_ATOMIC_STORE_SSIZE_RELAXED(entry->hash, 0);
}
#else
memset(table, 0, sizeof(setentry)*size);
Expand Down Expand Up @@ -581,18 +581,19 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
memcpy(small_copy, oldtable, sizeof(small_copy));
oldtable = small_copy;
}

assert(newtable != oldtable);
set_zero_table(newtable, PySet_MINSIZE);
}
else {
newtable = PyMem_NEW(setentry, newsize);
newtable = PyMem_Calloc(newsize, sizeof(setentry));
if (newtable == NULL) {
PyErr_NoMemory();
return -1;
}
}

/* Make the set empty, using the new table. */
assert(newtable != oldtable);
set_zero_table(newtable, newsize);
FT_ATOMIC_STORE_PTR_RELEASE(so->table, NULL);
FT_ATOMIC_STORE_SSIZE_RELEASE(so->mask, newsize - 1);

Expand Down
Loading