From 3c5af7383a75b076fa2575b4a543b37b31f6ff2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Tue, 28 May 2024 17:12:23 +0100 Subject: [PATCH 01/16] GH-119668: expose importlib.NamespacePath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Lib/importlib/_bootstrap_external.py | 15 +++++++++------ Lib/importlib/machinery.py | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 30c91801212374..8ce9e98841ca23 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1346,7 +1346,7 @@ def get_filename(self, fullname): return self.path -class _NamespacePath: +class NamespacePath: """Represents a namespace package's path. It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is recomputed, @@ -1405,7 +1405,7 @@ def __len__(self): return len(self._recalculate()) def __repr__(self): - return f'_NamespacePath({self._path!r})' + return f'NamespacePath({self._path!r})' def __contains__(self, item): return item in self._recalculate() @@ -1414,12 +1414,15 @@ def append(self, item): self._path.append(item) +_NamespacePath = NamespacePath # for backwards compatibility + + # This class is actually exposed publicly in a namespace package's __loader__ # attribute, so it should be available through a non-private name. # https://github.com/python/cpython/issues/92054 class NamespaceLoader: def __init__(self, name, path, path_finder): - self._path = _NamespacePath(name, path, path_finder) + self._path = NamespacePath(name, path, path_finder) def is_package(self, fullname): return True @@ -1474,9 +1477,9 @@ def invalidate_caches(): del sys.path_importer_cache[name] elif hasattr(finder, 'invalidate_caches'): finder.invalidate_caches() - # Also invalidate the caches of _NamespacePaths + # Also invalidate the caches of NamespacePaths # https://bugs.python.org/issue45703 - _NamespacePath._epoch += 1 + NamespacePath._epoch += 1 from importlib.metadata import MetadataPathFinder MetadataPathFinder.invalidate_caches() @@ -1562,7 +1565,7 @@ def find_spec(cls, fullname, path=None, target=None): # We found at least one namespace path. Return a spec which # can create the namespace package. spec.origin = None - spec.submodule_search_locations = _NamespacePath(fullname, namespace_path, cls._get_spec) + spec.submodule_search_locations = NamespacePath(fullname, namespace_path, cls._get_spec) return spec else: return None diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py index fbd30b159fb752..8809b8ec1e1cef 100644 --- a/Lib/importlib/machinery.py +++ b/Lib/importlib/machinery.py @@ -14,6 +14,7 @@ from ._bootstrap_external import ExtensionFileLoader from ._bootstrap_external import AppleFrameworkLoader from ._bootstrap_external import NamespaceLoader +from ._bootstrap_external import NamespacePath def all_suffixes(): From 668b8ff5fbb0abccbdb9450c54c394d6e64a8a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Tue, 28 May 2024 17:14:35 +0100 Subject: [PATCH 02/16] add news MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- .../next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst diff --git a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst new file mode 100644 index 00000000000000..cb49c819b22f40 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst @@ -0,0 +1 @@ +Expose :py:class:`importlib.NamespacePath`. From 02ceeb5390bdaa3c335b02068ba4075dc5b1f8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Tue, 28 May 2024 17:17:24 +0100 Subject: [PATCH 03/16] add to docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 2ec15dd171c18a..c8f53c49843b1c 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1006,6 +1006,14 @@ find and load modules. :exc:`ImportError` is raised. +.. class:: NamespacePath(name, path, path_finder) + + Represents a namespace package's path. It uses the module name to find its + parent module, and from there it looks up the parent's ``__path__``. When + this changes, the module's own path is recomputed, using path_finder. For + top-level modules, the parent module's path is :py:data:`sys.path`. + + .. class:: SourceFileLoader(fullname, path) A concrete implementation of :class:`importlib.abc.SourceLoader` by From 29df08fba99483c2cb7b60c8ddba4586d093f9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 21 Jul 2024 21:08:52 +0100 Subject: [PATCH 04/16] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/importlib.rst | 6 +++--- .../Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index c8f53c49843b1c..5e70b0953632ce 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1008,10 +1008,10 @@ find and load modules. .. class:: NamespacePath(name, path, path_finder) - Represents a namespace package's path. It uses the module name to find its + Represents a namespace package's path. It uses the module *name* to find its parent module, and from there it looks up the parent's ``__path__``. When - this changes, the module's own path is recomputed, using path_finder. For - top-level modules, the parent module's path is :py:data:`sys.path`. + this changes, the module's own path is recomputed, using *path_finder*. For + top-level modules, the parent module's path is :data:`sys.path`. .. class:: SourceFileLoader(fullname, path) diff --git a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst index cb49c819b22f40..7ad8dd03d8679d 100644 --- a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst +++ b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst @@ -1 +1 @@ -Expose :py:class:`importlib.NamespacePath`. +Expose :class:`importlib.NamespacePath`. From 0dd0520a351493b4ada8a1b2b9480c08d30f3842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 17 Nov 2024 03:38:34 +0000 Subject: [PATCH 05/16] Fix news (importlib.NamespacePath > importlib.machinery.NamespacePath) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- .../next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst index 7ad8dd03d8679d..69d9858ce186e0 100644 --- a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst +++ b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst @@ -1 +1 @@ -Expose :class:`importlib.NamespacePath`. +Expose :class:`importlib.machinery.NamespacePath`. From 06b89067b00c8431c51a422bd60c07a670060725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 17 Nov 2024 03:46:37 +0000 Subject: [PATCH 06/16] Link to module.__path__ in NamespacePath docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index ebfb2604621c7a..eafad46632d358 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -988,9 +988,10 @@ find and load modules. .. class:: NamespacePath(name, path, path_finder) Represents a namespace package's path. It uses the module *name* to find its - parent module, and from there it looks up the parent's ``__path__``. When - this changes, the module's own path is recomputed, using *path_finder*. For - top-level modules, the parent module's path is :data:`sys.path`. + parent module, and from there it looks up the parent's + :attr:`module.__path__`. When this changes, the module's own path is + recomputed, using *path_finder*. For top-level modules, the parent module's + path is :data:`sys.path`. .. class:: SourceFileLoader(fullname, path) From cd506a4ccb277556d7548370bd4c3b1274ec7fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 17 Nov 2024 03:57:00 +0000 Subject: [PATCH 07/16] Mention the path argument in the documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 13 ++++++++----- Lib/importlib/_bootstrap_external.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index eafad46632d358..649e71d9228b7a 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -987,11 +987,14 @@ find and load modules. .. class:: NamespacePath(name, path, path_finder) - Represents a namespace package's path. It uses the module *name* to find its - parent module, and from there it looks up the parent's - :attr:`module.__path__`. When this changes, the module's own path is - recomputed, using *path_finder*. For top-level modules, the parent module's - path is :data:`sys.path`. + Represents a namespace package's path. + + It uses the module *name* to find its parent module, and from there it looks + up the parent's :attr:`module.__path__`. When this changes, the module's own + path is recomputed, using *path_finder*. The initial package path value is + set to *path*. + + For top-level modules, the parent module's path is :data:`sys.path`. .. class:: SourceFileLoader(fullname, path) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 24d7afc502eaa6..b5768e8c5966d4 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1080,11 +1080,14 @@ def get_filename(self, fullname): class NamespacePath: - """Represents a namespace package's path. It uses the module name - to find its parent module, and from there it looks up the parent's - __path__. When this changes, the module's own path is recomputed, - using path_finder. For top-level modules, the parent module's path - is sys.path.""" + """Represents a namespace package's path. + + It uses the module name to find its parent module, and from there it looks + up the parent's __path__. When this changes, the module's own path is + recomputed, using path_finder. The initial package path value is set to path. + + For top-level modules, the parent module's path is sys.path. + """ # When invalidate_caches() is called, this epoch is incremented # https://bugs.python.org/issue45703 From 6f441c4462b9c0968113a0409d29955d6c50ccd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 17 Nov 2024 03:58:39 +0000 Subject: [PATCH 08/16] Simplify docs text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 3 +-- Lib/importlib/_bootstrap_external.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 649e71d9228b7a..2b38ab81e201b1 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -991,8 +991,7 @@ find and load modules. It uses the module *name* to find its parent module, and from there it looks up the parent's :attr:`module.__path__`. When this changes, the module's own - path is recomputed, using *path_finder*. The initial package path value is - set to *path*. + path is recomputed, using *path_finder*. The initial value is set to *path*. For top-level modules, the parent module's path is :data:`sys.path`. diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index b5768e8c5966d4..4a87f1cf0e8a32 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1084,7 +1084,7 @@ class NamespacePath: It uses the module name to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is - recomputed, using path_finder. The initial package path value is set to path. + recomputed, using path_finder. The initial value is set to path. For top-level modules, the parent module's path is sys.path. """ From 137652a97d8153e7833f3aaae7dc7300becf5d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sun, 17 Nov 2024 04:00:15 +0000 Subject: [PATCH 09/16] Highlight argument names in docs text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Lib/importlib/_bootstrap_external.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 4a87f1cf0e8a32..0ebcf381cf2789 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1082,9 +1082,9 @@ def get_filename(self, fullname): class NamespacePath: """Represents a namespace package's path. - It uses the module name to find its parent module, and from there it looks + It uses the module *name* to find its parent module, and from there it looks up the parent's __path__. When this changes, the module's own path is - recomputed, using path_finder. The initial value is set to path. + recomputed, using *path_finder*. The initial value is set to *path*. For top-level modules, the parent module's path is sys.path. """ From be415abf0284a99bd0a145bd204fd1cc4067dec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns=20=F0=9F=87=B5=F0=9F=87=B8?= Date: Thu, 9 Oct 2025 17:05:19 +0100 Subject: [PATCH 10/16] Update Lib/importlib/_bootstrap_external.py Co-authored-by: Brett Cannon --- Lib/importlib/_bootstrap_external.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 8bf29cae05bf22..028135dee31ac6 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1165,7 +1165,8 @@ def append(self, item): self._path.append(item) -_NamespacePath = NamespacePath # for backwards compatibility +# For backwards-compatibility for anyone desperate enough to get at the class back in the day. +_NamespacePath = NamespacePath # This class is actually exposed publicly in a namespace package's __loader__ From bb16ae1423ef3c9a662ba0e11b0593dc638ca660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 9 Oct 2025 20:00:23 +0100 Subject: [PATCH 11/16] Rewrite NamespacePath's doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index f348fa0b830db3..11c968e2b4e8e5 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1015,14 +1015,33 @@ find and load modules. .. class:: NamespacePath(name, path, path_finder) - Represents a namespace package's path. + Represents a :term:`namespace package`'s path (:attr:`module.__path__`). - It uses the module *name* to find its parent module, and from there it looks - up the parent's :attr:`module.__path__`. When this changes, the module's own - path is recomputed, using *path_finder*. The initial value is set to *path*. + When its value is accessed, if necessary, it will be recomputed. + This keeps it in-sync with the global state (:attr:`sys.modules`). + + The *name* argument is the name of the namespace module. + + The *path* argument is the initial path value. + + The *path_finder* argument is the callable used to recompute the path value. + It has the same signature as :meth:`MetaPathFinder.find_spec`. + + When the parent's :attr:`module.__path__` attribute is updated, the path + value is recomputed. + + If the parent module is missing from :data:`sys.modules`, then + :exc:`ModuleNotFoundError` will be raised. For top-level modules, the parent module's path is :data:`sys.path`. + .. note:: + + :meth:`PathFinder.invalidate_caches` invalidates :class:`NamespacePath`s, + forcing the path value to be recomputed next time it is accessed. + + .. versionadded:: next + .. class:: SourceFileLoader(fullname, path) From 9f52661fb7daf886088ad41c6f0defe4da213c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 9 Oct 2025 20:01:03 +0100 Subject: [PATCH 12/16] Specify path_finder's type in the NamespacePath docstring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Lib/importlib/_bootstrap_external.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 028135dee31ac6..1b99e77342cc7f 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1094,6 +1094,9 @@ class NamespacePath: recomputed, using *path_finder*. The initial value is set to *path*. For top-level modules, the parent module's path is sys.path. + + *path_finder* should be a callable with the same signature as + MetaPathFinder.find_spec ((fullname, path, target=None) -> spec). """ # When invalidate_caches() is called, this epoch is incremented From 0494d7befb3e8efb14184a0013122e387739ec95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 9 Oct 2025 23:11:51 +0100 Subject: [PATCH 13/16] Fix doc tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 11c968e2b4e8e5..7019ec1d5c9a1e 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1037,7 +1037,7 @@ find and load modules. .. note:: - :meth:`PathFinder.invalidate_caches` invalidates :class:`NamespacePath`s, + :meth:`PathFinder.invalidate_caches` invalidates :class:`NamespacePath`, forcing the path value to be recomputed next time it is accessed. .. versionadded:: next From 8ccb7ba739eedf536dd079ba93a7e3722e00ad9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Fri, 10 Oct 2025 06:39:30 +0100 Subject: [PATCH 14/16] Apply suggestions from code review Co-authored-by: Barry Warsaw --- Doc/library/importlib.rst | 4 ++-- Lib/importlib/_bootstrap_external.py | 2 +- .../Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 7019ec1d5c9a1e..5113d16113d06f 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1017,7 +1017,7 @@ find and load modules. Represents a :term:`namespace package`'s path (:attr:`module.__path__`). - When its value is accessed, if necessary, it will be recomputed. + When its `__path__` value is accessed it will be recomputed if necessary. This keeps it in-sync with the global state (:attr:`sys.modules`). The *name* argument is the name of the namespace module. @@ -1025,7 +1025,7 @@ find and load modules. The *path* argument is the initial path value. The *path_finder* argument is the callable used to recompute the path value. - It has the same signature as :meth:`MetaPathFinder.find_spec`. + The callable has the same signature as :meth:`MetaPathFinder.find_spec`. When the parent's :attr:`module.__path__` attribute is updated, the path value is recomputed. diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 1b99e77342cc7f..19ea66f8064385 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1096,7 +1096,7 @@ class NamespacePath: For top-level modules, the parent module's path is sys.path. *path_finder* should be a callable with the same signature as - MetaPathFinder.find_spec ((fullname, path, target=None) -> spec). + MetaPathFinder.find_spec((fullname, path, target=None) -> spec). """ # When invalidate_caches() is called, this epoch is incremented diff --git a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst index 69d9858ce186e0..87cdf8d89d5202 100644 --- a/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst +++ b/Misc/NEWS.d/next/Library/2024-05-28-17-14-30.gh-issue-119668.RrIGpn.rst @@ -1 +1 @@ -Expose :class:`importlib.machinery.NamespacePath`. +Publicly expose and document :class:`importlib.machinery.NamespacePath`. From 8bc2d6c44678e73e300945245c53d280bebe0d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Fri, 10 Oct 2025 06:54:02 +0100 Subject: [PATCH 15/16] Fix doc lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe Laíns --- Doc/library/importlib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 5113d16113d06f..561843bcfa8620 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1017,7 +1017,7 @@ find and load modules. Represents a :term:`namespace package`'s path (:attr:`module.__path__`). - When its `__path__` value is accessed it will be recomputed if necessary. + When its ``__path__`` value is accessed it will be recomputed if necessary. This keeps it in-sync with the global state (:attr:`sys.modules`). The *name* argument is the name of the namespace module. From 666816819ea8063205b4719556449c8c01360aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Sat, 1 Nov 2025 00:00:10 +0000 Subject: [PATCH 16/16] Update Doc/library/importlib.rst Co-authored-by: Brett Cannon --- Doc/library/importlib.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 561843bcfa8620..5ddfdde5bfaa62 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1025,7 +1025,7 @@ find and load modules. The *path* argument is the initial path value. The *path_finder* argument is the callable used to recompute the path value. - The callable has the same signature as :meth:`MetaPathFinder.find_spec`. + The callable has the same signature as :meth:`importlib.abc.MetaPathFinder.find_spec`. When the parent's :attr:`module.__path__` attribute is updated, the path value is recomputed.