Skip to content

Commit a43dbe1

Browse files
[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 7bf9456) Co-authored-by: Randy <[email protected]>
1 parent 050b6b3 commit a43dbe1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Doc/library/pkgutil.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ support.
2525
from pkgutil import extend_path
2626
__path__ = extend_path(__path__, __name__)
2727

28-
This will add to the package's ``__path__`` all subdirectories of directories
29-
on :data:`sys.path` named after the package. This is useful if one wants to
30-
distribute different parts of a single logical package as multiple
28+
For each directory on :data:`sys.path` that has a subdirectory that matches the
29+
package name, add the subdirectory to the package's :attr:`__path__`. This is useful
30+
if one wants to distribute different parts of a single logical package as multiple
3131
directories.
3232

3333
It also looks for :file:`\*.pkg` files beginning where ``*`` matches the

Lib/pkgutil.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,10 @@ def extend_path(path, name):
511511
from pkgutil import extend_path
512512
__path__ = extend_path(__path__, __name__)
513513
514-
This will add to the package's __path__ all subdirectories of
515-
directories on sys.path named after the package. This is useful
516-
if one wants to distribute different parts of a single logical
517-
package as multiple directories.
514+
For each directory on sys.path that has a subdirectory that
515+
matches the package name, add the subdirectory to the package's
516+
__path__. This is useful if one wants to distribute different
517+
parts of a single logical package as multiple directories.
518518
519519
It also looks for *.pkg files beginning where * matches the name
520520
argument. This feature is similar to *.pth files (see site.py),

0 commit comments

Comments
 (0)