bpo-32030: Add _PyMainInterpreterConfig.pythonhome (#4513)

* Py_Main() now reads the PYTHONHOME environment variable
* Add _Py_GetPythonHomeWithConfig() private function
* Add _PyWarnings_InitWithConfig()
* init_filters() doesn't get the current core configuration from the
  current interpreter or Python thread anymore. Pass explicitly the
  configuration to _PyWarnings_InitWithConfig().
* _Py_InitializeCore() now fails on _PyWarnings_InitWithConfig()
  failure.
* Pass configuration as constant
This commit is contained in:
Victor Stinner 2017-11-23 10:43:14 +01:00 committed by GitHub
parent e32e79f7d8
commit 1f15111a6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 136 additions and 43 deletions

View file

@ -456,13 +456,13 @@ search_for_exec_prefix(wchar_t *argv0_path, wchar_t *home,
}
static void
calculate_path(_PyMainInterpreterConfig *config)
calculate_path(const _PyMainInterpreterConfig *config)
{
extern wchar_t *Py_GetProgramName(void);
static const wchar_t delimiter[2] = {DELIM, '\0'};
static const wchar_t separator[2] = {SEP, '\0'};
wchar_t *home = Py_GetPythonHome();
wchar_t *home = _Py_GetPythonHomeWithConfig(config);
char *_path = getenv("PATH");
wchar_t *path_buffer = NULL;
wchar_t *path = NULL;
@ -858,7 +858,7 @@ Py_SetPath(const wchar_t *path)
}
wchar_t *
_Py_GetPathWithConfig(_PyMainInterpreterConfig *config)
_Py_GetPathWithConfig(const _PyMainInterpreterConfig *config)
{
if (!module_search_path) {
calculate_path(config);