document return value for PyImport_GetLazyImportsFilter

This commit is contained in:
Bénédikt Tran 2025-12-07 12:46:48 +01:00 committed by T. Wouters
parent b5121b0e59
commit 093f08b8ab
3 changed files with 6 additions and 2 deletions

View file

@ -349,7 +349,8 @@ Importing Modules
.. c:function:: PyObject* PyImport_GetLazyImportsFilter()
Gets the current lazy imports filter. Returns a :term:`strong reference`.
Return a :term:`strong reference` to the current lazy imports filter,
or ``NULL`` if none exists. This function always succeeds.
.. versionadded:: next

View file

@ -4802,7 +4802,9 @@ PyImport_SetLazyImportsFilter(PyObject *filter)
return 0;
}
/* Gets the lazy imports filter. Returns a new reference. */
/* Return a strong reference to the current lazy imports filter
* or NULL if none exists. This function always succeeds.
*/
PyObject *
PyImport_GetLazyImportsFilter(void)
{

View file

@ -2815,6 +2815,7 @@ sys_get_lazy_imports_filter_impl(PyObject *module)
{
PyObject *filter = PyImport_GetLazyImportsFilter();
if (filter == NULL) {
assert(!PyErr_Occurred());
Py_RETURN_NONE;
}
return filter;