Skip to content

Commit a577b5f

Browse files
Move __cached__ deprecation to its own section in datamodel.rst
1 parent dc0295c commit a577b5f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Doc/reference/datamodel.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ Attribute assignment updates the module's namespace dictionary, e.g.,
923923
single: __loader__ (module attribute)
924924
single: __path__ (module attribute)
925925
single: __file__ (module attribute)
926+
single: __cached__ (module attribute)
926927
single: __doc__ (module attribute)
927928
single: __annotations__ (module attribute)
928929
single: __annotate__ (module attribute)
@@ -1073,8 +1074,7 @@ this approach.
10731074
.. attribute:: module.__file__
10741075

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

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

1087+
.. attribute:: module.__cached__
1088+
1089+
An optional attribute, :attr:`!__cached__` indicates the pathname of the
1090+
compiled bytecode file.
1091+
1092+
.. deprecated-removed:: 3.12 3.15
1093+
Setting ``__cached__`` is deprecated. In Python 3.15,
1094+
``__cached__`` will cease to be set or taken into consideration by
1095+
the import system or standard library.
1096+
See :attr:`module.__spec__.cached <importlib.machinery.ModuleSpec.cached>`
1097+
instead.
1098+
10871099
Other writable attributes on module objects
10881100
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10891101

0 commit comments

Comments
 (0)