diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-23 09:43:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-23 09:43:14 (GMT) |
commit | 1f15111a6e15d52f6b08907576ec61493cd59358 (patch) | |
tree | b1a8fd55a1790e3dfd2026cc238e7344f293af90 /Include | |
parent | e32e79f7d8216b78ac9e61bb1f2eee693108d4ee (diff) | |
download | cpython-1f15111a6e15d52f6b08907576ec61493cd59358.zip cpython-1f15111a6e15d52f6b08907576ec61493cd59358.tar.gz cpython-1f15111a6e15d52f6b08907576ec61493cd59358.tar.bz2 |
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
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pylifecycle.h | 7 | ||||
-rw-r--r-- | Include/pystate.h | 5 | ||||
-rw-r--r-- | Include/warnings.h | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 5eaa74e..3b603c8 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -12,6 +12,10 @@ PyAPI_FUNC(wchar_t *) Py_GetProgramName(void); PyAPI_FUNC(void) Py_SetPythonHome(wchar_t *); PyAPI_FUNC(wchar_t *) Py_GetPythonHome(void); +#ifdef Py_BUILD_CORE +PyAPI_FUNC(wchar_t *) _Py_GetPythonHomeWithConfig( + const _PyMainInterpreterConfig *config); +#endif #ifndef Py_LIMITED_API /* Only used by applications that embed the interpreter and need to @@ -94,7 +98,8 @@ 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(_PyMainInterpreterConfig *config); +PyAPI_FUNC(wchar_t *) _Py_GetPathWithConfig( + const _PyMainInterpreterConfig *config); #endif PyAPI_FUNC(void) Py_SetPath(const wchar_t *); #ifdef MS_WINDOWS 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 { 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 { diff --git a/Include/warnings.h b/Include/warnings.h index a3f83ff..25f715e 100644 --- a/Include/warnings.h +++ b/Include/warnings.h @@ -7,6 +7,9 @@ extern "C" { #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyWarnings_Init(void); #endif +#ifdef Py_BUILD_CORE +PyAPI_FUNC(PyObject*) _PyWarnings_InitWithConfig(const _PyCoreConfig *config); +#endif PyAPI_FUNC(int) PyErr_WarnEx( PyObject *category, |