Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,15 @@ find and load modules.

.. class:: ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None)

A specification for a module's import-system-related state.
A specification for a module's import-system-related state. This is
typically exposed as the module's ``__spec__`` attribute. In the
descriptions below, the names in parentheses give the corresponding
attribute available directly on the module object.
E.g. ``module.__spec__.origin == module.__file__``. Note however that
while the *values* are usually equivalent, they can differ since there is
no synchronization between the two objects. Thus it is possible to update
the module's ``__path__`` at runtime, and this will not be automatically
reflected in ``__spec__.submodule_search_locations``.

.. versionadded:: 3.4

Expand Down
5 changes: 3 additions & 2 deletions Doc/reference/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,9 @@ and the loader that executes it. Most importantly, it allows the
import machinery to perform the boilerplate operations of loading,
whereas without a module spec the loader had that responsibility.

See :class:`~importlib.machinery.ModuleSpec` for more specifics on what
information a module's spec may hold.
The module's spec is exposed as the ``__spec__`` attribute on a module object.
See :class:`~importlib.machinery.ModuleSpec` for details on the contents of
the module spec.

.. versionadded:: 3.4

Expand Down