Skip to content

Commit 9629dfe

Browse files
miss-islingtonsobolevnencukouvstinner
authored
[3.14] gh-160669: Clarify PyDict_Update docs (GH-161314) (#161984)
gh-160669: Clarify `PyDict_Update` docs (GH-161314) (cherry picked from commit 797087c) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 74aea0d commit 9629dfe

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎Doc/c-api/dict.rst‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,14 @@ Dictionary Objects
405405
406406
.. c:function:: int PyDict_Update(PyObject *a, PyObject *b)
407407
408-
This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to
409-
``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall
410-
back to the iterating over a sequence of key value pairs if the second
411-
argument has no "keys" attribute. Return ``0`` on success or ``-1`` if an
412-
exception was raised.
408+
This is the same as ``PyDict_Merge(a, b, 1)`` in C.
409+
410+
Similar to ``a.update(b)`` in Python, except that this function
411+
does not fall back to the iterating over a sequence of key-value pairs
412+
if *b* is not a mapping.
413+
Use :c:func:`PyDict_MergeFromSeq2` for this case.
414+
415+
Return ``0`` on success or ``-1`` if an exception was raised.
413416
414417
.. note::
415418

0 commit comments

Comments
 (0)