From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Fri, 24 Oct 2025 13:37:09 +0000 (+0200) Subject: [3.13] Document that PyModule_GetDef can return NULL with or without setting an excep... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5c99b6c576be7a7f11ce7a95f1422b25954bb07e;p=thirdparty%2FPython%2Fcpython.git [3.13] Document that PyModule_GetDef can return NULL with or without setting an exception (GH-140529) (GH-140546) (cherry picked from commit 289360ae63933c8956f87307ff091ec9ed19afed) Co-authored-by: Petr Viktorin --- diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 811624e9a908..7ed6b4c908aa 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -102,6 +102,10 @@ Module Objects Return a pointer to the :c:type:`PyModuleDef` struct from which the module was created, or ``NULL`` if the module wasn't created from a definition. + On error, return ``NULL`` with an exception set. + Use :c:func:`PyErr_Occurred` to tell this case apart from a mising + :c:type:`!PyModuleDef`. + .. c:function:: PyObject* PyModule_GetFilenameObject(PyObject *module)