Skip to content

Commit cfdeb5c

Browse files
committed
fix: avoid increase the set->used twice when the __eq__ trigger another add
Signed-off-by: Keming <kemingy94@gmail.com>
1 parent 27f62eb commit cfdeb5c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Avoid increase the PySetOjbect->used twice when adding one element triggers
2+
__eq__ that cause another set.add

Objects/setobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ set_add_entry_takeref(PySetObject *so, PyObject *key, Py_hash_t hash)
180180
else if (entry->hash == -1) {
181181
assert (entry->key == dummy);
182182
freeslot = entry;
183+
goto found_unused_or_dummy;
183184
}
184185
entry++;
185186
} while (probes--);

0 commit comments

Comments
 (0)