diff options
author | Carl Meyer <carl@oddbird.net> | 2018-06-16 04:40:56 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2018-06-16 04:40:56 (GMT) |
commit | b193fa996a746111252156f11fb14c12fd6267e6 (patch) | |
tree | 1995957ce580ba762a19f64e41db2db32aec096a /Include | |
parent | 68680035143a3a6398faa88f067f244c74691d19 (diff) | |
download | cpython-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 'Include')
-rw-r--r-- | Include/pystate.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index 29d7148..8158cab 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -1,4 +1,3 @@ - /* Thread and interpreter state structures and their interfaces */ @@ -44,6 +43,7 @@ typedef struct { int coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */ int coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */ int utf8_mode; /* PYTHONUTF8, -X utf8; -1 means unknown */ + wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */ wchar_t *program_name; /* Program name, see also Py_GetProgramName() */ int argc; /* Number of command line arguments, @@ -101,6 +101,7 @@ typedef struct { PyObject *warnoptions; /* sys.warnoptions list, can be NULL */ PyObject *xoptions; /* sys._xoptions dict, can be NULL */ PyObject *module_search_path; /* sys.path list */ + PyObject *pycache_prefix; /* sys.pycache_prefix str, can be NULL */ } _PyMainInterpreterConfig; #define _PyMainInterpreterConfig_INIT \ |