mirror of https://github.com/python/cpython
Merge from 3.2.
The fix was already present in 3.3, but I merged two small changes recommended by Raymond while I was working on the 2.7 patch to ease future merges.
This commit is contained in:
commit
97054cf0b5
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue