[Python-checkins] [3.11] gh-68654: Clarify subdirectories used by pkgutil.extend_path (GH-103701)

CAM-Gerlach webhook-mailer at python.org
Sun Apr 23 04:57:17 EDT 2023


https://github.com/python/cpython/commit/a43dbe13e2827464afe06e4b73f461003de28d79
commit: a43dbe13e2827464afe06e4b73f461003de28d79
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: CAM-Gerlach <CAM.Gerlach at Gerlach.CAM>
date: 2023-04-23T02:57:10-06:00
summary:

[3.11] gh-68654: Clarify subdirectories used by pkgutil.extend_path (GH-103701)

gh-68654: Clarify subdirectories used by pkgutil.extend_path (GH-103701)

Clarify sub directories used by pkgutil.extend_path in the docs and the docstring
(cherry picked from commit 7bf94568a9a4101c72b8bf555a811028e5b45ced)

Co-authored-by: Randy <69558016+san-juan1667 at users.noreply.github.com>

files:
M Doc/library/pkgutil.rst
M Lib/pkgutil.py

diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst
index 788a02dcb892..66d753bd1a3c 100644
--- a/Doc/library/pkgutil.rst
+++ b/Doc/library/pkgutil.rst
@@ -25,9 +25,9 @@ support.
       from pkgutil import extend_path
       __path__ = extend_path(__path__, __name__)
 
-   This will add to the package's ``__path__`` all subdirectories of directories
-   on :data:`sys.path` named after the package.  This is useful if one wants to
-   distribute different parts of a single logical package as multiple
+   For each directory on :data:`sys.path` that has a subdirectory that matches the
+   package name, add the subdirectory to the package's :attr:`__path__`.  This is useful
+   if one wants to distribute different parts of a single logical package as multiple
    directories.
 
    It also looks for :file:`\*.pkg` files beginning where ``*`` matches the
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index bdebfd2fc8ac..56731de64af4 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -511,10 +511,10 @@ def extend_path(path, name):
         from pkgutil import extend_path
         __path__ = extend_path(__path__, __name__)
 
-    This will add to the package's __path__ all subdirectories of
-    directories on sys.path named after the package.  This is useful
-    if one wants to distribute different parts of a single logical
-    package as multiple directories.
+    For each directory on sys.path that has a subdirectory that
+    matches the package name, add the subdirectory to the package's
+    __path__.  This is useful if one wants to distribute different
+    parts of a single logical package as multiple directories.
 
     It also looks for *.pkg files beginning where * matches the name
     argument.  This feature is similar to *.pth files (see site.py),



More information about the Python-checkins mailing list