gh-141510: Update mp_length of frozendict to use non atomic operation (gh-144913)

This commit is contained in:
Donghee Na 2026-02-17 22:39:56 +09:00 committed by GitHub
parent 6ef2578f20
commit fc05e5e3d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3482,6 +3482,12 @@ dict_length(PyObject *self)
return GET_USED(_PyAnyDict_CAST(self));
}
static Py_ssize_t
frozendict_length(PyObject *self)
{
return _PyAnyDict_CAST(self)->ma_used;
}
static PyObject *
dict_subscript(PyObject *self, PyObject *key)
{
@ -7833,7 +7839,7 @@ static PyNumberMethods frozendict_as_number = {
};
static PyMappingMethods frozendict_as_mapping = {
.mp_length = dict_length,
.mp_length = frozendict_length,
.mp_subscript = dict_subscript,
};