@@ -50,10 +50,10 @@ The :mod:`runpy` module provides two functions:
5050 overridden by :func: `run_module `.
5151
5252 The special global variables ``__name__ ``, ``__spec__ ``, ``__file__ ``,
53- ``__cached__ ``, `` __loader__ `` and ``__package__ `` are set in the globals
54- dictionary before the module code is executed. (Note that this is a
55- minimal set of variables - other variables may be set implicitly as an
56- interpreter implementation detail.)
53+ ``__loader__ `` and ``__package__ `` are set in the globals dictionary before
54+ the module code is executed. (Note that this is a minimal set of variables -
55+ other variables may be set implicitly as an interpreter implementation
56+ detail.)
5757
5858 ``__name__ `` is set to *run_name * if this optional argument is not
5959 :const: `None `, to ``mod_name + '.__main__' `` if the named module is a
@@ -63,7 +63,7 @@ The :mod:`runpy` module provides two functions:
6363 module (that is, ``__spec__.name `` will always be *mod_name * or
6464 ``mod_name + '.__main__' ``, never *run_name *).
6565
66- ``__file__ ``, ``__cached__ ``, `` __loader__ `` and ``__package__ `` are
66+ ``__file__ ``, ``__loader__ `` and ``__package__ `` are
6767 :ref: `set as normal <import-mod-attrs >` based on the module spec.
6868
6969 If the argument *alter_sys * is supplied and evaluates to :const: `True `,
@@ -98,6 +98,9 @@ The :mod:`runpy` module provides two functions:
9898 ``__package__ `` are deprecated. See
9999 :class: `~importlib.machinery.ModuleSpec ` for alternatives.
100100
101+ .. versionchanged :: 3.15
102+ ``__cached__ `` is no longer set.
103+
101104.. function :: run_path(path_name, init_globals=None, run_name=None)
102105
103106 .. index ::
@@ -125,23 +128,23 @@ The :mod:`runpy` module provides two functions:
125128 overridden by :func: `run_path `.
126129
127130 The special global variables ``__name__ ``, ``__spec__ ``, ``__file__ ``,
128- ``__cached__ ``, `` __loader__ `` and ``__package__ `` are set in the globals
129- dictionary before the module code is executed. (Note that this is a
130- minimal set of variables - other variables may be set implicitly as an
131- interpreter implementation detail.)
131+ ``__loader__ `` and ``__package__ `` are set in the globals dictionary before
132+ the module code is executed. (Note that this is a minimal set of variables -
133+ other variables may be set implicitly as an interpreter implementation
134+ detail.)
132135
133136 ``__name__ `` is set to *run_name * if this optional argument is not
134137 :const: `None ` and to ``'<run_path>' `` otherwise.
135138
136139 If *file_path * directly references a script file (whether as source
137140 or as precompiled byte code), then ``__file__ `` will be set to
138- *file_path *, and ``__spec__ ``, ``__cached__ ``, `` __loader__ `` and
141+ *file_path *, and ``__spec__ ``, ``__loader__ `` and
139142 ``__package__ `` will all be set to :const: `None `.
140143
141144 If *file_path * is a reference to a valid :data: `sys.path ` entry, then
142145 ``__spec__ `` will be set appropriately for the imported :mod: `__main__ `
143146 module (that is, ``__spec__.name `` will always be ``__main__ ``).
144- ``__file__ ``, ``__cached__ ``, `` __loader__ `` and ``__package__ `` will be
147+ ``__file__ ``, ``__loader__ `` and ``__package__ `` will be
145148 :ref: `set as normal <import-mod-attrs >` based on the module spec.
146149
147150 A number of alterations are also made to the :mod: `sys ` module. Firstly,
@@ -173,6 +176,9 @@ The :mod:`runpy` module provides two functions:
173176 The setting of ``__cached__ ``, ``__loader__ ``, and
174177 ``__package__ `` are deprecated.
175178
179+ .. versionchanged :: 3.15
180+ ``__cached__ `` is no longer set.
181+
176182.. seealso ::
177183
178184 :pep: `338 ` -- Executing modules as scripts
0 commit comments