Skip to content

Commit dabf0f2

Browse files
vstinnermiss-islington
authored andcommitted
pythongh-101944: Clarify PyModule_AddObjectRef() documentation (pythonGH-129433)
(cherry picked from commit 04264a2) Co-authored-by: Victor Stinner <[email protected]>
1 parent eff45c9 commit dabf0f2

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
@@ -496,9 +496,6 @@ state:
496496
497497
On success, return ``0``. On error, raise an exception and return ``-1``.
498498
499-
Return ``-1`` if *value* is ``NULL``. It must be called with an exception
500-
raised in this case.
501-
502499
Example usage::
503500
504501
static int
@@ -513,6 +510,10 @@ state:
513510
return res;
514511
}
515512
513+
To be convenient, the function accepts ``NULL`` *value* with an exception
514+
set. In this case, return ``-1`` and just leave the raised exception
515+
unchanged.
516+
516517
The example can also be written without checking explicitly if *obj* is
517518
``NULL``::
518519

0 commit comments

Comments
 (0)