diff options
-rw-r--r-- | Objects/setobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index fbac596..83bff81 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -223,9 +223,13 @@ _set_add_entry(PySetObject *so, PyObject *key, Py_hash_t hash) entry->hash = hash; if ((size_t)so->fill*3 < mask*2) return 0; - return set_table_resize(so, so->used); + if (!set_table_resize(so, so->used)) + return 0; + Py_INCREF(key); + return -1; found_active: + Py_DECREF(key); return 0; } |