Skip to content

Commit 40d2d29

Browse files
committed
avoid table check
1 parent e630b64 commit 40d2d29

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Objects/setobject.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,18 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
105105
table = so->table;
106106
if (frozenset) {
107107
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
108+
if (cmp < 0)
109+
return NULL;
108110
} else {
109111
// incref startkey because it can be removed from the set by the compare
110112
Py_INCREF(startkey);
111113
cmp = PyObject_RichCompareBool(startkey, key, Py_EQ);
112114
Py_DECREF(startkey);
115+
if (cmp < 0)
116+
return NULL;
117+
if (table != so->table || entry->key != startkey)
118+
return set_lookkey(so, key, hash);
113119
}
114-
if (cmp < 0)
115-
return NULL;
116-
if (table != so->table || entry->key != startkey)
117-
return set_lookkey(so, key, hash);
118120
if (cmp > 0)
119121
return entry;
120122
mask = so->mask;

0 commit comments

Comments
 (0)