Skip to content

Commit 797087c

Browse files
sobolevnencukouvstinner
authored
gh-160669: Clarify PyDict_Update docs (#161314)
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 713c16e commit 797087c

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
@@ -472,11 +472,14 @@ Dictionary objects
472472
473473
.. c:function:: int PyDict_Update(PyObject *a, PyObject *b)
474474
475-
This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to
476-
``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall
477-
back to the iterating over a sequence of key value pairs if the second
478-
argument has no "keys" attribute. Return ``0`` on success or ``-1`` if an
479-
exception was raised.
475+
This is the same as ``PyDict_Merge(a, b, 1)`` in C.
476+
477+
Similar to ``a.update(b)`` in Python, except that this function
478+
does not fall back to the iterating over a sequence of key-value pairs
479+
if *b* is not a mapping.
480+
Use :c:func:`PyDict_MergeFromSeq2` for this case.
481+
482+
Return ``0`` on success or ``-1`` if an exception was raised.
480483
481484
.. note::
482485

0 commit comments

Comments
 (0)