Skip to content

Commit cc81f5b

Browse files
[3.11] [3.12] gh-108314: PyDict_GetItemString() mentions UTF-8 (GH-108448) (#108489)
[3.12] gh-108314: PyDict_GetItemString() mentions UTF-8 (GH-108448) gh-108314: PyDict_GetItemString() mentions UTF-8 PyDict_GetItemString(), PyDict_SetItemString() and PyDict_DelItemString() expects a UTF-8 encoding string for the key. (cherry picked from commit 9a225d7) Co-authored-by: Victor Stinner <[email protected]>
1 parent 5505bfd commit cc81f5b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Doc/c-api/dict.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Dictionary Objects
7373
.. index:: single: PyUnicode_FromString()
7474
7575
Insert *val* into the dictionary *p* using *key* as a key. *key* should
76-
be a :c:expr:`const char*`. The key object is created using
76+
be a :c:expr:`const char*` UTF-8 encoded bytes string. The key object is created using
7777
``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on
7878
failure. This function *does not* steal a reference to *val*.
7979
@@ -88,7 +88,8 @@ Dictionary Objects
8888
8989
.. c:function:: int PyDict_DelItemString(PyObject *p, const char *key)
9090
91-
Remove the entry in dictionary *p* which has a key specified by the string *key*.
91+
Remove the entry in dictionary *p* which has a key specified by the UTF-8
92+
encoded bytes string *key*.
9293
If *key* is not in the dictionary, :exc:`KeyError` is raised.
9394
Return ``0`` on success or ``-1`` on failure.
9495
@@ -120,7 +121,8 @@ Dictionary Objects
120121
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)
121122
122123
This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a
123-
:c:expr:`const char*`, rather than a :c:expr:`PyObject*`.
124+
:c:expr:`const char*` UTF-8 encoded bytes string, rather than a
125+
:c:expr:`PyObject*`.
124126
125127
.. note::
126128

0 commit comments

Comments
 (0)