summaryrefslogtreecommitdiffstats
path: root/Doc/library/compileall.rst
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2018-06-16 04:40:56 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-06-16 04:40:56 (GMT)
commitb193fa996a746111252156f11fb14c12fd6267e6 (patch)
tree1995957ce580ba762a19f64e41db2db32aec096a /Doc/library/compileall.rst
parent68680035143a3a6398faa88f067f244c74691d19 (diff)
downloadcpython-b193fa996a746111252156f11fb14c12fd6267e6.zip
cpython-b193fa996a746111252156f11fb14c12fd6267e6.tar.gz
cpython-b193fa996a746111252156f11fb14c12fd6267e6.tar.bz2
bpo-33499: Add PYTHONPYCACHEPREFIX env var for alt bytecode cache location. (GH-6834)
In some development setups it is inconvenient or impossible to write bytecode caches to the code tree, but the bytecode caches are still useful. The PYTHONPYCACHEPREFIX environment variable allows specifying an alternate location for cached bytecode files, within which a directory tree mirroring the code tree will be created. This cache tree is then used (for both reading and writing) instead of the local `__pycache__` subdirectory within each source directory. Exposed at runtime as sys.pycache_prefix (defaulting to None), and can be set from the CLI as "-X pycache_prefix=path". Patch by Carl Meyer.
Diffstat (limited to 'Doc/library/compileall.rst')
-rw-r--r--Doc/library/compileall.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst
index 7b3963d..22d1c6b 100644
--- a/Doc/library/compileall.rst
+++ b/Doc/library/compileall.rst
@@ -109,6 +109,11 @@ There is no command-line option to control the optimization level used by the
:func:`compile` function, because the Python interpreter itself already
provides the option: :program:`python -O -m compileall`.
+Similarly, the :func:`compile` function respects the :attr:`sys.pycache_prefix`
+setting. The generated bytecode cache will only be useful if :func:`compile` is
+run with the same :attr:`sys.pycache_prefix` (if any) that will be used at
+runtime.
+
Public functions
----------------