Skip to content

Commit 093f08b

Browse files
picnixzYhg1s
authored andcommitted
document return value for PyImport_GetLazyImportsFilter
1 parent b5121b0 commit 093f08b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Doc/c-api/import.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ Importing Modules
349349
350350
.. c:function:: PyObject* PyImport_GetLazyImportsFilter()
351351
352-
Gets the current lazy imports filter. Returns a :term:`strong reference`.
352+
Return a :term:`strong reference` to the current lazy imports filter,
353+
or ``NULL`` if none exists. This function always succeeds.
353354
354355
.. versionadded:: next
355356

Python/import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4802,7 +4802,9 @@ PyImport_SetLazyImportsFilter(PyObject *filter)
48024802
return 0;
48034803
}
48044804

4805-
/* Gets the lazy imports filter. Returns a new reference. */
4805+
/* Return a strong reference to the current lazy imports filter
4806+
* or NULL if none exists. This function always succeeds.
4807+
*/
48064808
PyObject *
48074809
PyImport_GetLazyImportsFilter(void)
48084810
{

Python/sysmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,7 @@ sys_get_lazy_imports_filter_impl(PyObject *module)
28152815
{
28162816
PyObject *filter = PyImport_GetLazyImportsFilter();
28172817
if (filter == NULL) {
2818+
assert(!PyErr_Occurred());
28182819
Py_RETURN_NONE;
28192820
}
28202821
return filter;

0 commit comments

Comments
 (0)