diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index cf5a0e71a104eb..1426e96aae306c 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -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) @@ -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 @@ -1084,14 +1084,17 @@ this approach. :ref:`import system ` 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 ` + instead. Other writable attributes on module objects ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^