mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-132657: optimize PySet_Contains for frozenset (GH-141183) (gh-141773)
(cherry picked from commit 7211a34fe1)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
c05e71f61e
commit
072eeaf84c
1 changed files with 3 additions and 1 deletions
|
|
@ -2746,7 +2746,9 @@ PySet_Contains(PyObject *anyset, PyObject *key)
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (PyFrozenSet_CheckExact(anyset)) {
|
||||||
|
return set_contains_key((PySetObject *)anyset, key);
|
||||||
|
}
|
||||||
int rv;
|
int rv;
|
||||||
Py_BEGIN_CRITICAL_SECTION(anyset);
|
Py_BEGIN_CRITICAL_SECTION(anyset);
|
||||||
rv = set_contains_key((PySetObject *)anyset, key);
|
rv = set_contains_key((PySetObject *)anyset, key);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue