summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorGéry Ogam <gery.ogam@gmail.com>2020-10-21 21:17:35 (GMT)
committerGitHub <noreply@github.com>2020-10-21 21:17:35 (GMT)
commit27f1bd8787d24ac53cc3dc6ea5eb00b8a3499839 (patch)
treedcab2a276f5f5b44190f2f7bb865d2e891809d2d /Doc/library/importlib.rst
parentf8b1ccd63c94bcde1c15d56d24add89861b6ceee (diff)
downloadcpython-27f1bd8787d24ac53cc3dc6ea5eb00b8a3499839.zip
cpython-27f1bd8787d24ac53cc3dc6ea5eb00b8a3499839.tar.gz
cpython-27f1bd8787d24ac53cc3dc6ea5eb00b8a3499839.tar.bz2
bpo-35181: Correct importlib documentation for some module attributes (GH-15190)
@ericsnowcurrently This PR will change the following: In the library documentation importlib.rst: - `module.__package__` can be `module.__name__` for packages; - `spec.parent` can be `spec.__name__` for packages; - `spec.loader` is not `None` for namespaces packages. In the language documentation import.rst: - `spec.loader` is not `None` for namespace packages. Automerge-Triggered-By: GH:warsaw
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 5fb0a4a..45b62ae 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -438,8 +438,9 @@ ABC hierarchy::
package. This attribute is not set on modules.
- :attr:`__package__`
- The parent package for the module/package. If the module is
- top-level then it has a value of the empty string. The
+ The fully-qualified name of the package under which the module was
+ loaded as a submodule (or the empty string for top-level modules).
+ For packages, it is the same as :attr:`__name__`. The
:func:`importlib.util.module_for_loader` decorator can handle the
details for :attr:`__package__`.
@@ -1347,8 +1348,8 @@ find and load modules.
(``__loader__``)
- The loader to use for loading. For namespace packages this should be
- set to ``None``.
+ The :term:`Loader <loader>` that should be used when loading
+ the module. :term:`Finders <finder>` should always set this.
.. attribute:: origin
@@ -1381,8 +1382,9 @@ find and load modules.
(``__package__``)
- (Read-only) Fully-qualified name of the package to which the module
- belongs as a submodule (or ``None``).
+ (Read-only) The fully-qualified name of the package under which the module
+ should be loaded as a submodule (or the empty string for top-level modules).
+ For packages, it is the same as :attr:`__name__`.
.. attribute:: has_location