summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorYilei Yang <yileiyang@google.com>2023-11-01 20:39:31 (GMT)
committerGitHub <noreply@github.com>2023-11-01 20:39:31 (GMT)
commit45a36d5f569fc50d37c2d4ca1ea0c611ebc40379 (patch)
tree0811a2cd4e499437446e7844b145065d85030e3b /Doc
parent7e135a48d619407cd4b2a6d80a4ce204b2f5f938 (diff)
downloadcpython-45a36d5f569fc50d37c2d4ca1ea0c611ebc40379.zip
cpython-45a36d5f569fc50d37c2d4ca1ea0c611ebc40379.tar.gz
cpython-45a36d5f569fc50d37c2d4ca1ea0c611ebc40379.tar.bz2
gh-111374: Add a new PYTHON_FROZEN_MODULES env var, equivalent of `-X frozen_modules`. (#111411)
Adds a new PYTHON_FROZEN_MODULES env var to correspond with -X frozen_modules. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/using/cmdline.rst25
-rw-r--r--Doc/whatsnew/3.13.rst5
2 files changed, 25 insertions, 5 deletions
diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst
index bd7b9b6..39c8d11 100644
--- a/Doc/using/cmdline.rst
+++ b/Doc/using/cmdline.rst
@@ -535,12 +535,13 @@ Miscellaneous options
location indicators when the interpreter displays tracebacks. See also
:envvar:`PYTHONNODEBUGRANGES`.
* ``-X frozen_modules`` determines whether or not frozen modules are
- ignored by the import machinery. A value of "on" means they get
- imported and "off" means they are ignored. The default is "on"
+ ignored by the import machinery. A value of ``on`` means they get
+ imported and ``off`` means they are ignored. The default is ``on``
if this is an installed Python (the normal case). If it's under
- development (running from the source tree) then the default is "off".
- Note that the "importlib_bootstrap" and "importlib_bootstrap_external"
- frozen modules are always used, even if this flag is set to "off".
+ development (running from the source tree) then the default is ``off``.
+ Note that the :mod:`!importlib_bootstrap` and
+ :mod:`!importlib_bootstrap_external` frozen modules are always used, even
+ if this flag is set to ``off``. See also :envvar:`PYTHON_FROZEN_MODULES`.
* ``-X perf`` enables support for the Linux ``perf`` profiler.
When this option is provided, the ``perf`` profiler will be able to
report Python calls. This option is only available on some platforms and
@@ -1095,6 +1096,20 @@ conflict.
.. versionadded:: 3.13
+.. envvar:: PYTHON_FROZEN_MODULES
+
+ If this variable is set to ``on`` or ``off``, it determines whether or not
+ frozen modules are ignored by the import machinery. A value of ``on`` means
+ they get imported and ``off`` means they are ignored. The default is ``on``
+ for non-debug builds (the normal case) and ``off`` for debug builds.
+ Note that the :mod:`!importlib_bootstrap` and
+ :mod:`!importlib_bootstrap_external` frozen modules are always used, even
+ if this flag is set to ``off``.
+
+ See also the :option:`-X frozen_modules <-X>` command-line option.
+
+ .. versionadded:: 3.13
+
Debug-mode variables
~~~~~~~~~~~~~~~~~~~~
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 9181685..b3fa06f 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -120,6 +120,11 @@ Other Language Changes
is rejected when the global is used in the :keyword:`else` block.
(Contributed by Irit Katriel in :gh:`111123`.)
+* Added a new environment variable :envvar:`PYTHON_FROZEN_MODULES`. It
+ determines whether or not frozen modules are ignored by the import machinery,
+ equivalent of the :option:`-X frozen_modules <-X>` command-line option.
+ (Contributed by Yilei Yang in :gh:`111374`.)
+
New Modules
===========