diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-05 01:01:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-05 01:01:27 (GMT) |
commit | cad1f747da47849ab5d8b0b881f7a0b94564d290 (patch) | |
tree | b66ed4ec4f2f26c08fde4989fbf2be680834973d /Include/cpython/coreconfig.h | |
parent | 7e9ce4c89e9a34ff84a89831812bc8b42d37ac1f (diff) | |
download | cpython-cad1f747da47849ab5d8b0b881f7a0b94564d290.zip cpython-cad1f747da47849ab5d8b0b881f7a0b94564d290.tar.gz cpython-cad1f747da47849ab5d8b0b881f7a0b94564d290.tar.bz2 |
bpo-36142: Add _PyPreConfig structure (GH-12172)
* Add _PyPreConfig structure
* Move 'ignored' and 'use_environment' fields from _PyCoreConfig
to _PyPreConfig
* Add a new "_PyPreConfig preconfig;" field to _PyCoreConfig
Diffstat (limited to 'Include/cpython/coreconfig.h')
-rw-r--r-- | Include/cpython/coreconfig.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/Include/cpython/coreconfig.h b/Include/cpython/coreconfig.h index 8ad3b23..7997d59 100644 --- a/Include/cpython/coreconfig.h +++ b/Include/cpython/coreconfig.h @@ -46,16 +46,35 @@ typedef struct { #define _Py_INIT_FAILED(err) \ (err.msg != NULL || err.exitcode != -1) -/* --- _PyCoreConfig ---------------------------------------------- */ +/* --- _PyPreConfig ----------------------------------------------- */ typedef struct { - /* Install signal handlers? Yes by default. */ - int install_signal_handlers; + /* If greater than 0, enable isolated mode: sys.path contains + neither the script's directory nor the user's site-packages directory. + + Set to 1 by the -I command line option. If set to -1 (default), inherit + Py_IsolatedFlag value. */ + int isolated; /* If greater than 0: use environment variables. Set to 0 by -E command line option. If set to -1 (default), it is set to !Py_IgnoreEnvironmentFlag. */ int use_environment; +} _PyPreConfig; + +#define _PyPreConfig_INIT \ + (_PyPreConfig){ \ + .isolated = -1, \ + .use_environment = -1} + + +/* --- _PyCoreConfig ---------------------------------------------- */ + +typedef struct { + _PyPreConfig preconfig; + + /* Install signal handlers? Yes by default. */ + int install_signal_handlers; int use_hash_seed; /* PYTHONHASHSEED=x */ unsigned long hash_seed; @@ -152,13 +171,6 @@ typedef struct { wchar_t *dll_path; /* Windows DLL path */ #endif - /* If greater than 0, enable isolated mode: sys.path contains - neither the script's directory nor the user's site-packages directory. - - Set to 1 by the -I command line option. If set to -1 (default), inherit - Py_IsolatedFlag value. */ - int isolated; - /* If equal to zero, disable the import of the module site and the site-dependent manipulations of sys.path that it entails. Also disable these manipulations if site is explicitly imported later (call @@ -336,8 +348,8 @@ typedef struct { #define _PyCoreConfig_INIT \ (_PyCoreConfig){ \ + .preconfig = _PyPreConfig_INIT, \ .install_signal_handlers = 1, \ - .use_environment = -1, \ .use_hash_seed = -1, \ .faulthandler = -1, \ .tracemalloc = -1, \ @@ -345,7 +357,6 @@ typedef struct { .utf8_mode = -1, \ .argc = -1, \ .nmodule_search_path = -1, \ - .isolated = -1, \ .site_import = -1, \ .bytes_warning = -1, \ .inspect = -1, \ |