diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-22 23:12:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-22 23:12:09 (GMT) |
commit | d4341109746aa15e1909e63b30b93b6133ffe401 (patch) | |
tree | 8982cc677ace3953484d4e4e34c8b154d0b9fb35 /Include | |
parent | 82656276caf4cb889193572d2d14dbc5f3d2bdff (diff) | |
download | cpython-d4341109746aa15e1909e63b30b93b6133ffe401.zip cpython-d4341109746aa15e1909e63b30b93b6133ffe401.tar.gz cpython-d4341109746aa15e1909e63b30b93b6133ffe401.tar.bz2 |
bpo-32030: Add _PyCoreConfig.module_search_path_env (#4504)
Changes:
* Py_Main() initializes _PyCoreConfig.module_search_path_env from
the PYTHONPATH environment variable.
* PyInterpreterState_New() now initializes core_config and config
fields
* Compute sys.path a little bit ealier in
_Py_InitializeMainInterpreter() and new_interpreter()
* Add _Py_GetPathWithConfig() private function.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pylifecycle.h | 3 | ||||
-rw-r--r-- | Include/pystate.h | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index a75b77c..2a5e73a 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -93,6 +93,9 @@ PyAPI_FUNC(wchar_t *) Py_GetProgramFullPath(void); PyAPI_FUNC(wchar_t *) Py_GetPrefix(void); PyAPI_FUNC(wchar_t *) Py_GetExecPrefix(void); PyAPI_FUNC(wchar_t *) Py_GetPath(void); +#ifdef Py_BUILD_CORE +PyAPI_FUNC(wchar_t *) _Py_GetPathWithConfig(_PyCoreConfig *config); +#endif PyAPI_FUNC(void) Py_SetPath(const wchar_t *); #ifdef MS_WINDOWS int _Py_CheckPython3(); diff --git a/Include/pystate.h b/Include/pystate.h index a3840c9..c5d3c33 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -30,6 +30,7 @@ typedef struct { unsigned long hash_seed; int _disable_importlib; /* Needed by freeze_importlib */ const char *allocator; /* Memory allocator: _PyMem_SetupAllocators() */ + wchar_t *module_search_path_env; /* PYTHONPATH environment variable */ int dev_mode; /* -X dev */ int faulthandler; /* -X faulthandler */ int tracemalloc; /* -X tracemalloc=N */ @@ -39,11 +40,13 @@ typedef struct { } _PyCoreConfig; #define _PyCoreConfig_INIT \ - {.ignore_environment = 0, \ + (_PyCoreConfig){\ + .ignore_environment = 0, \ .use_hash_seed = -1, \ .hash_seed = 0, \ ._disable_importlib = 0, \ .allocator = NULL, \ + .module_search_path_env = NULL, \ .dev_mode = 0, \ .faulthandler = 0, \ .tracemalloc = 0, \ @@ -61,7 +64,9 @@ typedef struct { int install_signal_handlers; } _PyMainInterpreterConfig; -#define _PyMainInterpreterConfig_INIT {-1} +#define _PyMainInterpreterConfig_INIT \ + (_PyMainInterpreterConfig){\ + .install_signal_handlers = -1} typedef struct _is { |