diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2018-01-24 16:03:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-24 16:03:28 (GMT) |
commit | 8ded5b803705328749622256701b3f08a9d6c5ab (patch) | |
tree | 18adbd5dae7461085c00c9d751163137fbc2dfe8 /Include | |
parent | 5de15f1d5ff09085620f63f0597d0920d75be719 (diff) | |
download | cpython-8ded5b803705328749622256701b3f08a9d6c5ab.zip cpython-8ded5b803705328749622256701b3f08a9d6c5ab.tar.gz cpython-8ded5b803705328749622256701b3f08a9d6c5ab.tar.bz2 |
bpo-32030: Add _PyCoreConfig.module_search_paths (#4954)
_PyCoreConfig_Read() is now responsible to compute sys.path.
So sys.path is now computed before calling _Py_InitializeCore().
Changes:
* Add module_search_path, module_search_paths, executable, prefix,
base_prefix, exec_prefix and base_exec_prefix to _PyCoreConfig.
* _PyMainInterpreterConfig_Read() now only converts wchar_t** lists
into a Python list, it doesn't compute sys.path anymore.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pystate.h | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/Include/pystate.h b/Include/pystate.h index d004be5..a19c1ed 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -26,29 +26,24 @@ typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int); typedef struct { int install_signal_handlers; /* Install signal handlers? -1 means unset */ - int ignore_environment; /* -E */ + + int ignore_environment; /* -E, Py_IgnoreEnvironmentFlag */ int use_hash_seed; /* PYTHONHASHSEED=x */ unsigned long hash_seed; - int _disable_importlib; /* Needed by freeze_importlib */ const char *allocator; /* Memory allocator: _PyMem_SetupAllocators() */ - int dev_mode; /* -X dev */ - int faulthandler; /* -X faulthandler */ - int tracemalloc; /* -X tracemalloc=N */ - int import_time; /* -X importtime */ + int dev_mode; /* PYTHONDEVMODE, -X dev */ + int faulthandler; /* PYTHONFAULTHANDLER, -X faulthandler */ + int tracemalloc; /* PYTHONTRACEMALLOC, -X tracemalloc=N */ + int import_time; /* PYTHONPROFILEIMPORTTIME, -X importtime */ int show_ref_count; /* -X showrefcount */ int show_alloc_count; /* -X showalloccount */ int dump_refs; /* PYTHONDUMPREFS */ int malloc_stats; /* PYTHONMALLOCSTATS */ int coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */ int coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */ - int utf8_mode; /* -X utf8 or PYTHONUTF8 environment variable, - -1 means unknown */ + int utf8_mode; /* PYTHONUTF8, -X utf8; -1 means unknown */ - wchar_t *module_search_path_env; /* PYTHONPATH environment variable */ - wchar_t *home; /* PYTHONHOME environment variable, - see also Py_SetPythonHome(). */ wchar_t *program_name; /* Program name, see also Py_GetProgramName() */ - int argc; /* Number of command line arguments, -1 means unset */ wchar_t **argv; /* Command line arguments */ @@ -59,6 +54,24 @@ typedef struct { int nwarnoption; /* Number of warnings options */ wchar_t **warnoptions; /* Warnings options */ + + /* Path configuration inputs */ + wchar_t *module_search_path_env; /* PYTHONPATH environment variable */ + wchar_t *home; /* PYTHONHOME environment variable, + see also Py_SetPythonHome(). */ + + /* Path configuration outputs */ + int nmodule_search_path; /* Number of sys.path paths, + -1 means unset */ + wchar_t **module_search_paths; /* sys.path paths */ + wchar_t *executable; /* sys.executable */ + wchar_t *prefix; /* sys.prefix */ + wchar_t *base_prefix; /* sys.base_prefix */ + wchar_t *exec_prefix; /* sys.exec_prefix */ + wchar_t *base_exec_prefix; /* sys.base_exec_prefix */ + + /* Private fields */ + int _disable_importlib; /* Needed by freeze_importlib */ } _PyCoreConfig; #define _PyCoreConfig_INIT \ @@ -67,7 +80,8 @@ typedef struct { .use_hash_seed = -1, \ .coerce_c_locale = -1, \ .utf8_mode = -1, \ - .argc = -1} + .argc = -1, \ + .nmodule_search_path = -1} /* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */ /* Placeholders while working on the new configuration API |