@@ -42,6 +42,12 @@ Dictionary objects
4242 enforces read-only behavior. This is normally used to create a view to
4343 prevent modification of the dictionary for non-dynamic class types.
4444
45+ The first argument can be a :class: `dict `, a :class: `frozendict `, or a
46+ mapping.
47+
48+ .. versionchanged :: next
49+ Also accept :class: `frozendict `.
50+
4551
4652.. c :var :: PyTypeObject PyDictProxy_Type
4753
@@ -68,15 +74,25 @@ Dictionary objects
6874 *key *, return ``1 ``, otherwise return ``0 ``. On error, return ``-1 ``.
6975 This is equivalent to the Python expression ``key in p ``.
7076
77+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
78+
79+ .. versionchanged :: next
80+ Also accept :class: `frozendict `.
81+
7182
7283.. c :function :: int PyDict_ContainsString (PyObject *p, const char *key)
7384
7485 This is the same as :c:func: `PyDict_Contains `, but *key * is specified as a
7586 :c:expr: `const char* ` UTF-8 encoded bytes string, rather than a
7687 :c:expr: `PyObject* `.
7788
89+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
90+
7891 .. versionadded :: 3.13
7992
93+ .. versionchanged :: next
94+ Also accept :class: `frozendict `.
95+
8096
8197.. c :function :: PyObject* PyDict_Copy (PyObject *p)
8298
@@ -158,8 +174,13 @@ Dictionary objects
158174 * If the key is missing, set *\* result * to ``NULL `` and return ``0 ``.
159175 * On error, raise an exception and return ``-1 ``.
160176
177+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
178+
161179 .. versionadded :: 3.13
162180
181+ .. versionchanged :: next
182+ Also accept :class: `frozendict `.
183+
163184 See also the :c:func: `PyObject_GetItem ` function.
164185
165186
@@ -169,6 +190,8 @@ Dictionary objects
169190 has a key *key *. Return ``NULL `` if the key *key * is missing *without *
170191 setting an exception.
171192
193+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
194+
172195 .. note ::
173196
174197 Exceptions that occur while this calls :meth: `~object.__hash__ ` and
@@ -186,6 +209,9 @@ Dictionary objects
186209 Calling this API without an :term: `attached thread state ` had been allowed for historical
187210 reason. It is no longer allowed.
188211
212+ .. versionchanged :: next
213+ Also accept :class: `frozendict `.
214+
189215
190216.. c :function :: PyObject* PyDict_GetItemWithError (PyObject *p, PyObject *key)
191217
@@ -201,6 +227,9 @@ Dictionary objects
201227 the dictionary concurrently. Prefer :c:func: `PyDict_GetItemRef `, which
202228 returns a :term: `strong reference `.
203229
230+ .. versionchanged :: next
231+ Also accept :class: `frozendict `.
232+
204233
205234.. c :function :: PyObject* PyDict_GetItemString (PyObject *p, const char *key)
206235
@@ -223,6 +252,9 @@ Dictionary objects
223252 the dictionary concurrently. Prefer :c:func: `PyDict_GetItemStringRef `,
224253 which returns a :term: `strong reference `.
225254
255+ .. versionchanged :: next
256+ Also accept :class: `frozendict `.
257+
226258
227259.. c :function :: int PyDict_GetItemStringRef (PyObject *p, const char *key, PyObject **result)
228260
@@ -232,6 +264,9 @@ Dictionary objects
232264
233265 .. versionadded :: 3.13
234266
267+ .. versionchanged :: next
268+ Also accept :class: `frozendict `.
269+
235270
236271.. c :function :: PyObject* PyDict_SetDefault (PyObject *p, PyObject *key, PyObject *defaultobj)
237272
@@ -321,17 +356,32 @@ Dictionary objects
321356
322357 Return a :c:type: `PyListObject ` containing all the items from the dictionary.
323358
359+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
360+
361+ .. versionchanged :: next
362+ Also accept :class: `frozendict `.
363+
324364
325365.. c :function :: PyObject* PyDict_Keys (PyObject *p)
326366
327367 Return a :c:type: `PyListObject ` containing all the keys from the dictionary.
328368
369+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
370+
371+ .. versionchanged :: next
372+ Also accept :class: `frozendict `.
373+
329374
330375.. c :function :: PyObject* PyDict_Values (PyObject *p)
331376
332377 Return a :c:type: `PyListObject ` containing all the values from the dictionary
333378 *p *.
334379
380+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
381+
382+ .. versionchanged :: next
383+ Also accept :class: `frozendict `.
384+
335385
336386.. c :function :: Py_ssize_t PyDict_Size (PyObject *p)
337387
@@ -340,11 +390,19 @@ Dictionary objects
340390 Return the number of items in the dictionary. This is equivalent to
341391 ``len(p) `` on a dictionary.
342392
393+ The argument can be a :class: `dict ` or a :class: `frozendict `.
394+
395+ .. versionchanged :: next
396+ Also accept :class: `frozendict `.
397+
343398
344399.. c :function :: Py_ssize_t PyDict_GET_SIZE (PyObject *p)
345400
346401 Similar to :c:func: `PyDict_Size `, but without error checking.
347402
403+ .. versionchanged :: next
404+ Also accept :class: `frozendict `.
405+
348406
349407.. c :function :: int PyDict_Next (PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue)
350408
@@ -359,6 +417,8 @@ Dictionary objects
359417 value represents offsets within the internal dictionary structure, and
360418 since the structure is sparse, the offsets are not consecutive.
361419
420+ The first argument can be a :class: `dict ` or a :class: `frozendict `.
421+
362422 For example::
363423
364424 PyObject *key, *value;
@@ -392,7 +452,7 @@ Dictionary objects
392452 }
393453
394454 The function is not thread-safe in the :term: `free-threaded <free threading> `
395- build without external synchronization. You can use
455+ build without external synchronization for a mutable :class: ` dict `. You can use
396456 :c:macro: `Py_BEGIN_CRITICAL_SECTION ` to lock the dictionary while iterating
397457 over it::
398458
@@ -402,6 +462,8 @@ Dictionary objects
402462 }
403463 Py_END_CRITICAL_SECTION();
404464
465+ The function is thread-safe on a :class: `frozendict `.
466+
405467 .. note ::
406468
407469 On the free-threaded build, this function can be used safely inside a
@@ -412,6 +474,9 @@ Dictionary objects
412474 :term: `strong reference <strong reference> ` (for example, using
413475 :c:func: `Py_NewRef `).
414476
477+ .. versionchanged:: next
478+ Also accept :class:`frozendict`.
479+
415480.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override)
416481
417482 Iterate over mapping object *b * adding key-value pairs to dictionary *a *.
0 commit comments