Merge from 3.1.
The fix was already committed to 3.2, but I merged two small changes
recommended by Raymond while I was working on the 2.7 patch to ease
future merges.
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 478b5cb..48edad8 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -365,11 +365,12 @@
{
register Py_ssize_t n_used;
PyObject *key = entry->key;
+ Py_hash_t hash = entry->hash;
assert(so->fill <= so->mask); /* at least one empty slot */
n_used = so->used;
Py_INCREF(key);
- if (set_insert_key(so, key, entry->hash) == -1) {
+ if (set_insert_key(so, key, hash) == -1) {
Py_DECREF(key);
return -1;
}
@@ -639,6 +640,7 @@
{
PySetObject *other;
PyObject *key;
+ Py_hash_t hash;
register Py_ssize_t i;
register setentry *entry;
@@ -660,10 +662,11 @@
for (i = 0; i <= other->mask; i++) {
entry = &other->table[i];
key = entry->key;
+ hash = entry->hash;
if (key != NULL &&
key != dummy) {
Py_INCREF(key);
- if (set_insert_key(so, key, entry->hash) == -1) {
+ if (set_insert_key(so, key, hash) == -1) {
Py_DECREF(key);
return -1;
}