Skip to content

Commit 186165e

Browse files
[3.13] gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (#129612)
gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (cherry picked from commit 04264a2) Co-authored-by: Victor Stinner <[email protected]>
1 parent 85e1620 commit 186165e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/c-api/module.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,6 @@ state:
523523
524524
On success, return ``0``. On error, raise an exception and return ``-1``.
525525
526-
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
527-
raised in this case.
528-
529526
Example usage::
530527
531528
static int
@@ -540,6 +537,10 @@ state:
540537
return res;
541538
}
542539
540+
To be convenient, the function accepts ``NULL`` *value* with an exception
541+
set. In this case, return ``-1`` and just leave the raised exception
542+
unchanged.
543+
543544
The example can also be written without checking explicitly if *obj* is
544545
``NULL``::
545546

0 commit comments

Comments
 (0)