Skip to content

Commit 0119335

Browse files
committed
Mention also frozendict in the doc body
1 parent 847567f commit 0119335

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

Doc/c-api/dict.rst

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ 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+
4548
.. versionchanged:: next
4649
Accept also :class:`frozendict`.
4750
@@ -71,13 +74,20 @@ Dictionary objects
7174
*key*, return ``1``, otherwise return ``0``. On error, return ``-1``.
7275
This is equivalent to the Python expression ``key in p``.
7376
77+
The first argument can be a :class:`dict` or a :class:`frozendict`.
78+
79+
.. versionchanged:: next
80+
Also accept :class:`frozendict`.
81+
7482
7583
.. c:function:: int PyDict_ContainsString(PyObject *p, const char *key)
7684
7785
This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a
7886
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
7987
:c:expr:`PyObject*`.
8088
89+
The first argument can be a :class:`dict` or a :class:`frozendict`.
90+
8191
.. versionadded:: 3.13
8292
8393
.. versionchanged:: next
@@ -88,10 +98,6 @@ Dictionary objects
8898
8999
Return a new dictionary that contains the same key-value pairs as *p*.
90100
91-
.. versionchanged:: next
92-
If *p* is a subclass of :class:`frozendict`, the result will be a
93-
:class:`frozendict` instance instead of a :class:`dict` instance.
94-
95101
.. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
96102
97103
Insert *val* into the dictionary *p* with a key of *key*. *key* must be
@@ -132,6 +138,8 @@ Dictionary objects
132138
* If the key is missing, set *\*result* to ``NULL`` and return ``0``.
133139
* On error, raise an exception and return ``-1``.
134140
141+
The first argument can be a :class:`dict` or a :class:`frozendict`.
142+
135143
.. versionadded:: 3.13
136144
137145
.. versionchanged:: next
@@ -146,6 +154,8 @@ Dictionary objects
146154
has a key *key*. Return ``NULL`` if the key *key* is missing *without*
147155
setting an exception.
148156
157+
The first argument can be a :class:`dict` or a :class:`frozendict`.
158+
149159
.. note::
150160
151161
Exceptions that occur while this calls :meth:`~object.__hash__` and
@@ -167,6 +177,8 @@ Dictionary objects
167177
occurred. Return ``NULL`` **without** an exception set if the key
168178
wasn't present.
169179
180+
The first argument can be a :class:`dict` or a :class:`frozendict`.
181+
170182
.. versionchanged:: next
171183
Accept also :class:`frozendict`.
172184
@@ -177,6 +189,8 @@ Dictionary objects
177189
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
178190
:c:expr:`PyObject*`.
179191
192+
The first argument can be a :class:`dict` or a :class:`frozendict`.
193+
180194
.. note::
181195
182196
Exceptions that occur while this calls :meth:`~object.__hash__` and
@@ -195,6 +209,8 @@ Dictionary objects
195209
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
196210
:c:expr:`PyObject*`.
197211
212+
The first argument can be a :class:`dict` or a :class:`frozendict`.
213+
198214
.. versionadded:: 3.13
199215
200216
.. versionchanged:: next
@@ -263,6 +279,8 @@ Dictionary objects
263279
264280
Return a :c:type:`PyListObject` containing all the items from the dictionary.
265281
282+
The first argument can be a :class:`dict` or a :class:`frozendict`.
283+
266284
.. versionchanged:: next
267285
Accept also :class:`frozendict`.
268286
@@ -271,6 +289,8 @@ Dictionary objects
271289
272290
Return a :c:type:`PyListObject` containing all the keys from the dictionary.
273291
292+
The first argument can be a :class:`dict` or a :class:`frozendict`.
293+
274294
.. versionchanged:: next
275295
Accept also :class:`frozendict`.
276296
@@ -280,6 +300,8 @@ Dictionary objects
280300
Return a :c:type:`PyListObject` containing all the values from the dictionary
281301
*p*.
282302
303+
The first argument can be a :class:`dict` or a :class:`frozendict`.
304+
283305
.. versionchanged:: next
284306
Accept also :class:`frozendict`.
285307
@@ -291,6 +313,8 @@ Dictionary objects
291313
Return the number of items in the dictionary. This is equivalent to
292314
``len(p)`` on a dictionary.
293315
316+
The argument can be a :class:`dict` or a :class:`frozendict`.
317+
294318
.. versionchanged:: next
295319
Accept also :class:`frozendict`.
296320
@@ -316,6 +340,8 @@ Dictionary objects
316340
value represents offsets within the internal dictionary structure, and
317341
since the structure is sparse, the offsets are not consecutive.
318342
343+
The first argument can be a :class:`dict` or a :class:`frozendict`.
344+
319345
For example::
320346
321347
PyObject *key, *value;

0 commit comments

Comments
 (0)