@@ -76,6 +76,12 @@ Dictionary objects
7676
7777 The first argument can be a :class: `dict ` or a :class: `frozendict `.
7878
79+ .. note ::
80+
81+ The operation is atomic in the :term: `free-threaded build `, if *key *
82+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
83+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
84+
7985 .. versionchanged:: next
8086 Also accept :class:`frozendict`.
8187
@@ -107,12 +113,9 @@ Dictionary objects
107113
108114 .. note ::
109115
110- In the :term: `free-threaded build `, key hashing via
111- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
112- can execute arbitrary Python code, during which the :term: `per-object
113- lock ` may be temporarily released. For built-in key types
114- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
115- during comparison.
116+ The operation is atomic in the :term: `free-threaded build `, if *key *
117+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
118+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
116119
117120
118121.. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val)
@@ -121,15 +124,6 @@ Dictionary objects
121124 specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
122125 rather than a :c:expr: `PyObject* `.
123126
124- .. note ::
125-
126- In the :term: `free-threaded build `, key hashing via
127- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
128- can execute arbitrary Python code, during which the :term: `per-object
129- lock ` may be temporarily released. For built-in key types
130- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
131- during comparison.
132-
133127
134128.. c :function :: int PyDict_DelItem (PyObject *p, PyObject *key)
135129
@@ -140,12 +134,9 @@ Dictionary objects
140134
141135 .. note ::
142136
143- In the :term: `free-threaded build `, key hashing via
144- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
145- can execute arbitrary Python code, during which the :term: `per-object
146- lock ` may be temporarily released. For built-in key types
147- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
148- during comparison.
137+ The operation is atomic in the :term: `free-threaded build `, if *key *
138+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
139+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
149140
150141
151142.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key)
@@ -154,15 +145,6 @@ Dictionary objects
154145 specified as a :c:expr: `const char* ` UTF-8 encoded bytes string,
155146 rather than a :c:expr: `PyObject* `.
156147
157- .. note ::
158-
159- In the :term: `free-threaded build `, key hashing via
160- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
161- can execute arbitrary Python code, during which the :term: `per-object
162- lock ` may be temporarily released. For built-in key types
163- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
164- during comparison.
165-
166148
167149.. c :function :: int PyDict_GetItemRef (PyObject *p, PyObject *key, PyObject **result)
168150
@@ -176,6 +158,12 @@ Dictionary objects
176158
177159 The first argument can be a :class: `dict ` or a :class: `frozendict `.
178160
161+ .. note ::
162+
163+ The operation is atomic in the :term: `free-threaded build `, if *key *
164+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
165+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
166+
179167 .. versionadded:: 3.13
180168
181169 .. versionchanged:: next
@@ -305,6 +293,12 @@ Dictionary objects
305293 These may refer to the same object: in that case you hold two separate
306294 references to it.
307295
296+ .. note::
297+
298+ The operation is atomic in the :term:`free-threaded build`, if *key*
299+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
300+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
301+
308302 .. versionadded:: 3.13
309303
310304
@@ -322,16 +316,13 @@ Dictionary objects
322316 Similar to :meth: `dict.pop `, but without the default value and
323317 not raising :exc: `KeyError ` if the key is missing.
324318
325- .. versionadded :: 3.13
326-
327319 .. note ::
328320
329- In the :term: `free-threaded build `, key hashing via
330- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
331- can execute arbitrary Python code, during which the :term: `per-object
332- lock ` may be temporarily released. For built-in key types
333- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
334- during comparison.
321+ The operation is atomic in the :term: `free-threaded build `, if *key *
322+ is a builtin type (e.g. :class: `str `, :class: `int `, :class: `float `) or any
323+ other object which does not define :meth:`~object.__hash__` and :meth:`~object.__eq__` methods.
324+
325+ .. versionadded:: 3.13
335326
336327
337328.. c:function:: int PyDict_PopString(PyObject *p, const char *key, PyObject **result)
@@ -342,15 +333,6 @@ Dictionary objects
342333
343334 .. versionadded :: 3.13
344335
345- .. note ::
346-
347- In the :term: `free-threaded build `, key hashing via
348- :meth: `~object.__hash__ ` and key comparison via :meth: `~object.__eq__ `
349- can execute arbitrary Python code, during which the :term: `per-object
350- lock ` may be temporarily released. For built-in key types
351- (:class: `str `, :class: `int `, :class: `float `), the lock is not released
352- during comparison.
353-
354336
355337.. c :function :: PyObject* PyDict_Items (PyObject *p)
356338
0 commit comments