@@ -1534,7 +1534,6 @@ This section describes other dictionary APIs that are simple to describe and hav
1534
1534
1535
1535
.. index ::
1536
1536
single: Dictionary; PyDict_GetItemWithError()
1537
- pair: Documentation Lacunae; PyDict_GetItemWithError()
1538
1537
1539
1538
.. _chapter_containers_and_refcounts.dictionaries.pydict_getitemwitherror :
1540
1539
@@ -1550,34 +1549,12 @@ The C signature is:
1550
1549
1551
1550
PyObject *PyDict_GetItemWithError(PyObject *p, PyObject *key);
1552
1551
1553
- .. warning ::
1554
-
1555
- This function is incorrectly documented as it fails to set an exception with a missing key as this code
1556
- demonstrates:
1557
-
1558
- .. code-block :: c
1552
+ Currently, the only failure mode is if the first argument is not a dictionary.
1559
1553
1560
- assert(!PyErr_Occurred());
1561
- PyObject *container = PyDict_New();
1562
- assert(container && Py_REFCNT(container) == 1);
1563
-
1564
- PyObject *key = new_unique_string(__FUNCTION__, NULL);
1565
-
1566
- assert(!PyErr_Occurred());
1567
- PyObject *get_item = PyDict_GetItemWithError(container, key);
1568
- /* This is the failure point. An exception should have been set with
1569
- * an absent key but it isn't. */
1570
- assert(!PyErr_Occurred());
1571
-
1572
- assert(get_item == NULL);
1573
-
1574
- Py_DECREF(container);
1575
- Py_DECREF(key);
1576
-
1577
- For code and tests see:
1554
+ For code and tests see:
1578
1555
1579
- * C, in ``src/cpy/Containers/DebugContainers.c ``:
1580
- * ``dbg_PyDict_GetItemWithError_fails() ``
1556
+ * C, in ``src/cpy/Containers/DebugContainers.c ``:
1557
+ * ``dbg_PyDict_GetItemWithError_fails() ``
1581
1558
1582
1559
.. index ::
1583
1560
single: Dictionary; PyDict_DelItem()
0 commit comments