summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-10-02 16:39:20 (GMT)
committerGitHub <noreply@github.com>2020-10-02 16:39:20 (GMT)
commit6dc8e0eb9b471f6665f841216a6b2d83741b3973 (patch)
tree7ee6c9e93d772174b45c2f058b3043dc41c36e8f
parent8fc828ec4e867c111cef137a2daeea6c3d5db2c7 (diff)
downloadcpython-6dc8e0eb9b471f6665f841216a6b2d83741b3973.zip
cpython-6dc8e0eb9b471f6665f841216a6b2d83741b3973.tar.gz
cpython-6dc8e0eb9b471f6665f841216a6b2d83741b3973.tar.bz2
bpo-41802: Document 'PyDict_DelItem' can raise a 'KeyError' (GH-22291)
(cherry picked from commit 20ce62f00957d11f24f6449cd5c0ef5dd67174d4) Co-authored-by: Campbell Barton <ideasman42@gmail.com>
-rw-r--r--Doc/c-api/dict.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst
index 6b3f45e..8c626c7 100644
--- a/Doc/c-api/dict.rst
+++ b/Doc/c-api/dict.rst
@@ -81,14 +81,16 @@ Dictionary Objects
.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key)
Remove the entry in dictionary *p* with key *key*. *key* must be hashable;
- if it isn't, :exc:`TypeError` is raised. Return ``0`` on success or ``-1``
- on failure.
+ if it isn't, :exc:`TypeError` is raised.
+ If *key* is not in the dictionary, :exc:`KeyError` is raised.
+ Return ``0`` on success or ``-1`` on failure.
.. 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*. Return ``0`` on success or ``-1`` on failure.
+ Remove the entry in dictionary *p* which has a key specified by the string *key*.
+ If *key* is not in the dictionary, :exc:`KeyError` is raised.
+ Return ``0`` on success or ``-1`` on failure.
.. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key)