]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41802: Document 'PyDict_DelItem' can raise a 'KeyError' (GH-22291)
authorCampbell Barton <ideasman42@gmail.com>
Fri, 2 Oct 2020 16:18:01 +0000 (02:18 +1000)
committerGitHub <noreply@github.com>
Fri, 2 Oct 2020 16:18:01 +0000 (19:18 +0300)
Doc/c-api/dict.rst

index 769484134ed5154fb24110b78ebe50e94d80cf63..8e0d6845463490a49404a00e925a11f4bb802bd4 100644 (file)
@@ -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)