https://github.com/python/cpython/commit/072eeaf84cdc4cae4a7e6a72c408b3281fba2b26 commit: 072eeaf84cdc4cae4a7e6a72c408b3281fba2b26 branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: nascheme <[email protected]> date: 2025-11-19T17:01:49-08:00 summary:
[3.14] gh-132657: optimize `PySet_Contains` for `frozenset` (GH-141183) (gh-141773) (cherry picked from commit 7211a34fe1d9704935342af8c9b46725629f2d97) Co-authored-by: Kumar Aditya <[email protected]> files: M Objects/setobject.c diff --git a/Objects/setobject.c b/Objects/setobject.c index 9332c24ac8673b..ff4844b24371e8 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -2746,7 +2746,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); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
