bpo-32030: Add _PyMainInterpreterConfig_ReadEnv() (#4542)
Py_GetPath() and Py_Main() now call
_PyMainInterpreterConfig_ReadEnv() to share the same code to get
environment variables.
Changes:
* Add _PyMainInterpreterConfig_ReadEnv()
* Add _PyMainInterpreterConfig_Clear()
* Add _PyMem_RawWcsdup()
* _PyMainInterpreterConfig: rename pythonhome to home
* Rename _Py_ReadMainInterpreterConfig() to
_PyMainInterpreterConfig_Read()
* Use _Py_INIT_USER_ERR(), instead of _Py_INIT_ERR(), for decoding
errors: the user is able to fix the issue, it's not a bug in
Python. Same change was made in _Py_INIT_NO_MEMORY().
* Remove _Py_GetPythonHomeWithConfig()
diff --git a/Include/pystate.h b/Include/pystate.h
index ab6400c..533851f 100644
--- a/Include/pystate.h
+++ b/Include/pystate.h
@@ -60,16 +60,17 @@
*/
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(). */
+ /* PYTHONPATH environment variable */
+ wchar_t *module_search_path_env;
+ /* PYTHONHOME environment variable, see also Py_SetPythonHome(). */
+ wchar_t *home;
} _PyMainInterpreterConfig;
#define _PyMainInterpreterConfig_INIT \
(_PyMainInterpreterConfig){\
.install_signal_handlers = -1, \
.module_search_path_env = NULL, \
- .pythonhome = NULL}
+ .home = NULL}
typedef struct _is {