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
diff --git a/Include/pystate.h b/Include/pystate.h
index b2739f1..ab6400c 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -61,12 +61,15 @@
typedef struct {
int install_signal_handlers;
wchar_t *module_search_path_env; /* PYTHONPATH environment variable */
+ wchar_t *pythonhome; /* PYTHONHOME environment variable,
+ see also Py_SetPythonHome(). */
} _PyMainInterpreterConfig;
#define _PyMainInterpreterConfig_INIT \
(_PyMainInterpreterConfig){\
.install_signal_handlers = -1, \
- .module_search_path_env = NULL}
+ .module_search_path_env = NULL, \
+ .pythonhome = NULL}
typedef struct _is {