summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-03-23 02:43:22 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-03-23 02:43:22 (GMT)
commitbbcfc1f2d926c1198b4c23a6e5640e3f3aee9d98 (patch)
treeb895d09843982ea12c860d25507619ef1ec615f4 /Objects/setobject.c
parentb1aef23316b093e042bc6afa7e52cd9d7c95802c (diff)
parent48049911d6ff4f3caebc09a28c0a94e0c7ad8842 (diff)
downloadcpython-bbcfc1f2d926c1198b4c23a6e5640e3f3aee9d98.zip
cpython-bbcfc1f2d926c1198b4c23a6e5640e3f3aee9d98.tar.gz
cpython-bbcfc1f2d926c1198b4c23a6e5640e3f3aee9d98.tar.bz2
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.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c7
1 files changed, 5 insertions, 2 deletions
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 @@ set_add_entry(register PySetObject *so, setentry *entry)
{
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 @@ set_merge(PySetObject *so, PyObject *otherset)
{
PySetObject *other;
PyObject *key;
+ Py_hash_t hash;
register Py_ssize_t i;
register setentry *entry;
@@ -660,10 +662,11 @@ set_merge(PySetObject *so, PyObject *otherset)
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;
}