diff --git a/Objects/setobject.c b/Objects/setobject.c index 83004e57b66c20..81eeafb82d1886 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2731,7 +2731,9 @@ PySet_Contains(PyObject *anyset, PyObject *key) PyErr_BadInternalCall(); return -1; } - + if (PyFrozenSet_CheckExact(anyset)) { + return set_contains_key((PySetObject *)anyset, key); + } int rv; Py_BEGIN_CRITICAL_SECTION(anyset); rv = set_contains_key((PySetObject *)anyset, key);