From f869e9cfb7def9a296caff8decf0ba8df39bda1d Mon Sep 17 00:00:00 2001 From: johnslavik Date: Mon, 16 Feb 2026 00:46:08 +0100 Subject: [PATCH 1/4] Clarify lazy import filters have positional-only arguments --- Doc/library/sys.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 4c76feafc9b4922..b5e91fffa416e2d 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1783,7 +1783,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only signature:: def filter(importing_module: str, imported_module: str, - fromlist: tuple[str, ...] | None) -> bool + fromlist: tuple[str, ...] | None, /) -> bool Where: @@ -1792,6 +1792,8 @@ always available. Unless explicitly noted otherwise, all variables are read-only * *fromlist* is the tuple of names being imported (for ``from ... import`` statements), or ``None`` for regular imports + and all of them are positional arguments. + The filter should return ``True`` to allow the import to be lazy, or ``False`` to force an eager import. From 4eebd62309f0279760f30a3480fce4bcd2fbfe3e Mon Sep 17 00:00:00 2001 From: johnslavik Date: Mon, 16 Feb 2026 01:06:27 +0100 Subject: [PATCH 2/4] Don't describe arguments as positional in written sentences --- Doc/library/sys.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index b5e91fffa416e2d..de82e30ef62e998 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1792,8 +1792,6 @@ always available. Unless explicitly noted otherwise, all variables are read-only * *fromlist* is the tuple of names being imported (for ``from ... import`` statements), or ``None`` for regular imports - and all of them are positional arguments. - The filter should return ``True`` to allow the import to be lazy, or ``False`` to force an eager import. From d4c5563154c8f6afe70f1c6f0c758ee337839291 Mon Sep 17 00:00:00 2001 From: johnslavik Date: Fri, 24 Jul 2026 20:54:03 +0200 Subject: [PATCH 3/4] Make the docs more correct --- Doc/library/sys.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index de82e30ef62e998..e0b80183d6ee76c 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1779,7 +1779,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only callable or ``None`` to clear the filter. The filter function is called for every potentially lazy import to - determine whether it should actually be lazy. It must have the following + determine whether it should actually be lazy. It has the following signature:: def filter(importing_module: str, imported_module: str, @@ -1792,6 +1792,8 @@ always available. Unless explicitly noted otherwise, all variables are read-only * *fromlist* is the tuple of names being imported (for ``from ... import`` statements), or ``None`` for regular imports + These arguments are passed positionally. + The filter should return ``True`` to allow the import to be lazy, or ``False`` to force an eager import. From ca4de399af6942b5bbc84030385a728d24465743 Mon Sep 17 00:00:00 2001 From: johnslavik Date: Fri, 24 Jul 2026 20:58:51 +0200 Subject: [PATCH 4/4] Remove the trailing `/` --- Doc/library/sys.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index e0b80183d6ee76c..c57f3b2827d062a 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1783,7 +1783,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only signature:: def filter(importing_module: str, imported_module: str, - fromlist: tuple[str, ...] | None, /) -> bool + fromlist: tuple[str, ...] | None) -> bool Where: