Skip to content
Open
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
19 changes: 11 additions & 8 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ Attribute assignment updates the module's namespace dictionary, e.g.,
single: __loader__ (module attribute)
single: __path__ (module attribute)
single: __file__ (module attribute)
single: __cached__ (module attribute)
single: __doc__ (module attribute)
single: __annotations__ (module attribute)
single: __annotate__ (module attribute)
Expand Down Expand Up @@ -1073,8 +1074,7 @@ this approach.
.. attribute:: module.__file__

:attr:`!__file__` is an optional attribute that
may or may not be set. Both attributes should be a :class:`str` when they
are available.
may or may not be set. When available, it should be a :class:`str`.

An optional attribute, :attr:`!__file__` indicates the pathname of the file
from which the module was loaded (if loaded from a file), or the pathname of
Expand All @@ -1084,14 +1084,17 @@ this approach.
:ref:`import system <importsystem>` may opt to leave it unset if it
has no semantic meaning (for example, a module loaded from a database).

.. deprecated-removed:: 3.13 3.15
Setting ``__cached__`` on a module while failing to set
:attr:`!__spec__.cached` is deprecated. In Python 3.15,
.. attribute:: module.__cached__

An optional attribute, :attr:`!__cached__` indicates the pathname of the
compiled bytecode file.

.. deprecated-removed:: 3.12 3.15
Setting ``__cached__`` is deprecated. In Python 3.15,
``__cached__`` will cease to be set or taken into consideration by
the import system or standard library.

.. versionchanged:: 3.15
``__cached__`` is no longer set.
See :attr:`module.__spec__.cached <importlib.machinery.ModuleSpec.cached>`
instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like you've moved it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now properly moved the cached deprecation notice to its own dedicated section in datamodel.rst
and updated the documentation for file to remove the plural reference. Thanks for catching that!

Other writable attributes on module objects
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading