diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-25 16:48:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 16:48:25 (GMT) |
commit | cc81f5b61a3a2023c61a1f41892f45a4479a694f (patch) | |
tree | 40df9be31ecb6e939e6f7879084524e73e337f62 /Doc/c-api | |
parent | 5505bfd687be376c9ed7dd9fca55e25d3c1515e3 (diff) | |
download | cpython-cc81f5b61a3a2023c61a1f41892f45a4479a694f.zip cpython-cc81f5b61a3a2023c61a1f41892f45a4479a694f.tar.gz cpython-cc81f5b61a3a2023c61a1f41892f45a4479a694f.tar.bz2 |
[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 9a225d7d5b0530ee73fa00d4816897997a9eb733)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/dict.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index e6919b0..c923379 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -73,7 +73,7 @@ Dictionary Objects .. index:: single: PyUnicode_FromString() Insert *val* into the dictionary *p* using *key* as a key. *key* should - be a :c:expr:`const char*`. The key object is created using + be a :c:expr:`const char*` UTF-8 encoded bytes string. The key object is created using ``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on failure. This function *does not* steal a reference to *val*. @@ -88,7 +88,8 @@ Dictionary Objects .. c:function:: int PyDict_DelItemString(PyObject *p, const char *key) - Remove the entry in dictionary *p* which has a key specified by the string *key*. + Remove the entry in dictionary *p* which has a key specified by the UTF-8 + encoded bytes string *key*. If *key* is not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on failure. @@ -120,7 +121,8 @@ Dictionary Objects .. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key) This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a - :c:expr:`const char*`, rather than a :c:expr:`PyObject*`. + :c:expr:`const char*` UTF-8 encoded bytes string, rather than a + :c:expr:`PyObject*`. .. note:: |