[Python-checkins] cpython: Call set_lookkey() directly to avoid unnecessary memory spills and reloads.
raymond.hettinger
python-checkins at python.org
Sat Jul 4 03:31:15 CEST 2015
https://hg.python.org/cpython/rev/fa3ed4e75ccd
changeset: 96789:fa3ed4e75ccd
user: Raymond Hettinger <python at rcn.com>
date: Fri Jul 03 18:31:09 2015 -0700
summary:
Call set_lookkey() directly to avoid unnecessary memory spills and reloads.
files:
Objects/setobject.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -678,7 +678,7 @@
static int
set_contains_key(PySetObject *so, PyObject *key)
{
- setentry entry;
+ setentry *entry;
Py_hash_t hash;
if (!PyUnicode_CheckExact(key) ||
@@ -687,9 +687,10 @@
if (hash == -1)
return -1;
}
- entry.key = key;
- entry.hash = hash;
- return set_contains_entry(so, &entry);
+ entry = set_lookkey(so, key, hash);
+ if (entry == NULL)
+ return -1;
+ return entry->key != NULL;
}
static PyObject *
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list