diff options
author | Raymond Hettinger <python@rcn.com> | 2015-01-26 00:38:52 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-01-26 00:38:52 (GMT) |
commit | b335dfe7fa95c8c68630e8f7dc738c7b66637e87 (patch) | |
tree | 9f6546fdcb24f2b526f6debe48617d8fcbf94774 /Objects | |
parent | 4d45c1069b014581c7be4b38a89c36bc57d3c216 (diff) | |
download | cpython-b335dfe7fa95c8c68630e8f7dc738c7b66637e87.zip cpython-b335dfe7fa95c8c68630e8f7dc738c7b66637e87.tar.gz cpython-b335dfe7fa95c8c68630e8f7dc738c7b66637e87.tar.bz2 |
Set the hash values of dummy entries to -1. Improves quality of entry->hash == hash tests.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/setobject.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 8a2f351..f44f562 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -337,6 +337,7 @@ set_discard_entry(PySetObject *so, setentry *oldentry) return DISCARD_NOTFOUND; old_key = entry->key; entry->key = dummy; + entry->hash = -1; so->used--; Py_DECREF(old_key); return DISCARD_FOUND; @@ -621,6 +622,7 @@ set_pop(PySetObject *so) } key = entry->key; entry->key = dummy; + entry->hash = -1; so->used--; so->finger = i + 1; /* next place to start */ return key; |