https://github.com/python/cpython/commit/a7645468c2ef356599299789a5105706f38c8b0e commit: a7645468c2ef356599299789a5105706f38c8b0e branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2025-02-03T12:02:31Z summary:
[3.12] gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (#129613) gh-101944: Clarify PyModule_AddObjectRef() documentation (GH-129433) (cherry picked from commit 04264a286e5ddfe8ac7423f7376ca34a2ca8b7ba) Co-authored-by: Victor Stinner <[email protected]> files: M Doc/c-api/module.rst diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index cfa6a1a985245e..b110443d927070 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -496,9 +496,6 @@ state: On success, return ``0``. On error, raise an exception and return ``-1``. - Return ``-1`` if *value* is ``NULL``. It must be called with an exception - raised in this case. - Example usage:: static int @@ -513,6 +510,10 @@ state: return res; } + To be convenient, the function accepts ``NULL`` *value* with an exception + set. In this case, return ``-1`` and just leave the raised exception + unchanged. + The example can also be written without checking explicitly if *obj* is ``NULL``:: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
