Skip to content

Commit c98f517

Browse files
vstinnersrinivasreddy
authored andcommitted
pythongh-101944: Clarify PyModule_AddObjectRef() documentation (python#129433)
1 parent fdc2ce5 commit c98f517

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/c-api/module.rst

+4-3
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)