From 3376493386abaee314a7b8357c20a8a17e8cd3ac Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 16:38:42 +0300 Subject: [PATCH 1/6] gh-160669: Fix `PyDict_Update` docs --- Doc/c-api/dict.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index 4ac4445e25886c7..25d2b1c19f426d6 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -472,11 +472,8 @@ 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. + Return ``0`` on success or ``-1`` if an exception was raised. .. note:: From 77466e6abbf9c4d23420cf91af9b9cc01d6f3fc9 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 17:41:44 +0300 Subject: [PATCH 2/6] Update Doc/c-api/dict.rst Co-authored-by: Petr Viktorin --- Doc/c-api/dict.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index 25d2b1c19f426d6..e00c2c77cfaad64 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -474,6 +474,10 @@ Dictionary objects This is the same as ``PyDict_Merge(a, b, 1)`` in C. Return ``0`` on success or ``-1`` if an exception was raised. + + 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. .. note:: From 17007091fa64f710600d2fa00d9b6fcad24d8700 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 17:44:18 +0300 Subject: [PATCH 3/6] Update Doc/c-api/dict.rst --- Doc/c-api/dict.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index e00c2c77cfaad64..1af349e94c6ddc5 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -474,7 +474,6 @@ Dictionary objects This is the same as ``PyDict_Merge(a, b, 1)`` in C. Return ``0`` on success or ``-1`` if an exception was raised. - 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. From 438e3635edfdcd98b122a61f70e14d3fda718e87 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 19:14:56 +0300 Subject: [PATCH 4/6] Update Doc/c-api/dict.rst Co-authored-by: Victor Stinner --- Doc/c-api/dict.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index 1af349e94c6ddc5..f115d4da238811a 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -473,10 +473,12 @@ Dictionary objects .. c:function:: int PyDict_Update(PyObject *a, PyObject *b) This is the same as ``PyDict_Merge(a, b, 1)`` in C. - Return ``0`` on success or ``-1`` if an exception was raised. + 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. .. note:: From 14e2f90c328b09dc0096ecc12360e26b5052e899 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 19:32:30 +0300 Subject: [PATCH 5/6] Update Doc/c-api/dict.rst --- Doc/c-api/dict.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index f115d4da238811a..520aa8d3dbdee2c 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -473,11 +473,11 @@ Dictionary objects .. c:function:: int PyDict_Update(PyObject *a, PyObject *b) This is the same as ``PyDict_Merge(a, b, 1)`` in C. - + 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. .. note:: From 5a5a392aff83db486bcbd462c99f8a9adf8125e6 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 4 Nov 2026 22:41:10 +0300 Subject: [PATCH 6/6] Update Doc/c-api/dict.rst --- Doc/c-api/dict.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index 520aa8d3dbdee2c..3eec1c8edc1a632 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -475,8 +475,8 @@ Dictionary objects This is the same as ``PyDict_Merge(a, b, 1)`` in C. 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. + doesn't not support a sequence of key value pairs as *b* parameter. + Use :c:func:`PyDict_MergeFromSeq2` in this case. Return ``0`` on success or ``-1`` if an exception was raised.