https://github.com/python/cpython/commit/fc05e5e3d7bcd59a64eabb8b94ee7af4d0bcc4d5
commit: fc05e5e3d7bcd59a64eabb8b94ee7af4d0bcc4d5
branch: main
author: Donghee Na <[email protected]>
committer: corona10 <[email protected]>
date: 2026-02-17T13:39:56Z
summary:

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

files:
M Objects/dictobject.c

diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 46b0148cf59ab5..510a0fab468cc6 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -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,
 };
 

_______________________________________________
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]

Reply via email to