From f19404a52f9aba64e4ade81d10bc815205fa3d8f Mon Sep 17 00:00:00 2001 From: sobolevn Date: Sat, 14 Nov 2026 08:42:42 +0300 Subject: [PATCH] gh-160669: Clarify `PyDict_Update` docs (GH-161314) (cherry picked from commit 797087c386dfaeaafe7fdd741194f10100f3ac13) Co-authored-by: sobolevn Co-authored-by: Petr Viktorin Co-authored-by: Victor Stinner --- Doc/c-api/dict.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index 4ac4445e25886c..4d78924b07dd9c 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -472,11 +472,14 @@ Dictionary objects .. c:function:: int PyDict_Update(PyObject *a, PyObject *b) - This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to - ``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall - back to the iterating over a sequence of key value pairs if the second - argument has no "keys" attribute. Return ``0`` on success or ``-1`` if an - exception was raised. + This is the same as ``PyDict_Merge(a, b, 1)`` in C. + + Similar to ``a.update(b)`` in Python, except that this function + does not fall back to the iterating over a sequence of key-value pairs + if *b* is not a mapping. + Use :c:func:`PyDict_MergeFromSeq2` for this case. + + Return ``0`` on success or ``-1`` if an exception was raised. .. note::