From 6f8a75669a050199bc5667e9e0ad27ea69723e19 Mon Sep 17 00:00:00 2001 From: oda-gitso Date: Thu, 16 Feb 2023 23:48:58 +0700 Subject: [PATCH 1/4] fix-issue-101944 --- Doc/c-api/module.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index e2ba157b32c7d9..2c82237775e3be 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -451,8 +451,8 @@ state: On success, return ``0``. On error, raise an exception and return ``-1``. - Return ``NULL`` if *value* is ``NULL``. It must be called with an exception - raised in this case. + Return ``-1`` if *value* is ``NULL``. In this case, the function raises an + exception if called without an exception raised. Example usage:: From 16c5efaf896eb27c836340c090122261c43eb84e Mon Sep 17 00:00:00 2001 From: oda-gitso Date: Sat, 18 Feb 2023 17:32:51 +0700 Subject: [PATCH 2/4] Try different wording for second sentence --- Doc/c-api/module.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 2c82237775e3be..9a6b8f29cf6b00 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -451,8 +451,8 @@ state: On success, return ``0``. On error, raise an exception and return ``-1``. - Return ``-1`` if *value* is ``NULL``. In this case, the function raises an - exception if called without an exception raised. + Return ``-1`` if *value* is ``NULL``. In this case, if the function is + called without an exception already set, it raises an exception. Example usage:: From 9cc9af3749e9ee02946d7c0a4fddc5d1056c22a9 Mon Sep 17 00:00:00 2001 From: Owain Davies Date: Tue, 21 Feb 2023 00:02:15 +0700 Subject: [PATCH 3/4] Different wording --- Doc/c-api/module.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 9a6b8f29cf6b00..3c3a3aaea93c55 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -451,8 +451,9 @@ state: On success, return ``0``. On error, raise an exception and return ``-1``. - Return ``-1`` if *value* is ``NULL``. In this case, if the function is - called without an exception already set, it raises an exception. + If *value* is ``NULL`` and an exception is set, return ``-1``. If *value* + is ``NULL`` and no exception is set, raise :exc:`SystemError` and return + ``-1``. Example usage:: From a7b7a73ecf27f4878c73abd29b697057f61a8ca0 Mon Sep 17 00:00:00 2001 From: Owain Davies Date: Sun, 25 Jun 2023 17:18:48 +0700 Subject: [PATCH 4/4] try different wording after suggestions from review --- Doc/c-api/module.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 08439eb337a2bd..bc5fa32ac5acec 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -449,11 +449,11 @@ state: Add an object to *module* as *name*. This is a convenience function which can be used from the module's initialization function. - On success, return ``0``. On error, raise an exception and return ``-1``. + On success, return ``0``. - If *value* is ``NULL`` and an exception is set, return ``-1``. If *value* - is ``NULL`` and no exception is set, raise :exc:`SystemError` and return - ``-1``. + If *value* is ``NULL`` (indicating failure), raise an exception and return + ``-1``. If an exception is set, raise that exception. If no exception is + set, raise :exc:`SystemError`. Example usage::