From 2abbc1e30e0aaa01733ae75444e08d9516cef82d Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Thu, 7 May 2026 11:46:38 -0600 Subject: [PATCH 1/2] Clarify docs for error case of PyDict_GetItemRef --- Doc/c-api/dict.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index a2a0d0d80657eb..abe0aae9902b74 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -151,7 +151,7 @@ Dictionary objects * If the key is present, set *\*result* to a new :term:`strong reference` to the value and return ``1``. * If the key is missing, set *\*result* to ``NULL`` and return ``0``. - * On error, raise an exception and return ``-1``. + * On error, raise an exception, set *\*result* to ``NULL``, and return ``-1``. The first argument can be a :class:`dict` or a :class:`frozendict`. From 3a0b666534b45992887a6d0fbfbb955c8278e2b0 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Thu, 7 May 2026 14:46:19 -0600 Subject: [PATCH 2/2] Apply suggestion from @ngoldbaum --- Doc/c-api/dict.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst index abe0aae9902b74..556113a97bf772 100644 --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -151,7 +151,7 @@ Dictionary objects * If the key is present, set *\*result* to a new :term:`strong reference` to the value and return ``1``. * If the key is missing, set *\*result* to ``NULL`` and return ``0``. - * On error, raise an exception, set *\*result* to ``NULL``, and return ``-1``. + * On error, raise an exception, set *\*result* to ``NULL`` and return ``-1``. The first argument can be a :class:`dict` or a :class:`frozendict`.