summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2013-08-21 08:34:18 (GMT)
committerRaymond Hettinger <python@rcn.com>2013-08-21 08:34:18 (GMT)
commit5bb1b1dd6f94af0e8cb2d4a1686bc4882147ba66 (patch)
tree5d6a4718b198cda514742aa8ecf3a7c3dd7df282 /Objects
parent929cbac307aceaedbe0fa302aba8c23a9644e207 (diff)
downloadcpython-5bb1b1dd6f94af0e8cb2d4a1686bc4882147ba66.zip
cpython-5bb1b1dd6f94af0e8cb2d4a1686bc4882147ba66.tar.gz
cpython-5bb1b1dd6f94af0e8cb2d4a1686bc4882147ba66.tar.bz2
Hoist the global dummy lookup out of the inner loop for set_merge().
Diffstat (limited to 'Objects')
-rw-r--r--Objects/setobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 9074a76..f84c929 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -683,6 +683,7 @@ set_merge(PySetObject *so, PyObject *otherset)
{
PySetObject *other;
PyObject *key;
+ PyObject *dummy_entry;
Py_hash_t hash;
Py_ssize_t i;
setentry *entry;
@@ -702,12 +703,13 @@ set_merge(PySetObject *so, PyObject *otherset)
if (set_table_resize(so, (so->used + other->used)*2) != 0)
return -1;
}
+ dummy_entry = dummy;
for (i = 0; i <= other->mask; i++) {
entry = &other->table[i];
key = entry->key;
hash = entry->hash;
if (key != NULL &&
- key != dummy) {
+ key != dummy_entry) {
Py_INCREF(key);
if (set_insert_key(so, key, hash) == -1) {
Py_DECREF(key);