summaryrefslogtreecommitdiffstats
path: root/Objects/setobject.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-07-04 01:31:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-07-04 01:31:09 (GMT)
commit3c1f52e829e9877225cb171d779aacc4c6353daf (patch)
tree44ea2ee05335dc94386ddd1f865a22a1eb072df1 /Objects/setobject.c
parent15f08696096a80d026ed21164f892a661fc72e98 (diff)
downloadcpython-3c1f52e829e9877225cb171d779aacc4c6353daf.zip
cpython-3c1f52e829e9877225cb171d779aacc4c6353daf.tar.gz
cpython-3c1f52e829e9877225cb171d779aacc4c6353daf.tar.bz2
Call set_lookkey() directly to avoid unnecessary memory spills and reloads.
Diffstat (limited to 'Objects/setobject.c')
-rw-r--r--Objects/setobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 56084c1..bf9718e 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -678,7 +678,7 @@ set_contains_entry(PySetObject *so, setentry *entry)
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 @@ set_contains_key(PySetObject *so, PyObject *key)
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 *