diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-24 22:55:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-24 22:55:40 +0100 |
commit | 46972b7bc385ec2bdc7f567bbd22c9e56ffdf003 (patch) | |
tree | e55f61feac1afb22e18bb33274a5e3f0beec5355 /Include/pylifecycle.h | |
parent | 84c4b1938fade2b425ac906730beabd413de094d (diff) | |
download | cpython-git-46972b7bc385ec2bdc7f567bbd22c9e56ffdf003.tar.gz |
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()
Diffstat (limited to 'Include/pylifecycle.h')
-rw-r--r-- | Include/pylifecycle.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index efdc58eed8..ff91532338 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -30,7 +30,7 @@ typedef struct { Don't abort() the process on such error. */ #define _Py_INIT_USER_ERR(MSG) \ (_PyInitError){.prefix = _Py_INIT_GET_FUNC(), .msg = (MSG), .user_err = 1} -#define _Py_INIT_NO_MEMORY() _Py_INIT_ERR("memory allocation failed") +#define _Py_INIT_NO_MEMORY() _Py_INIT_USER_ERR("memory allocation failed") #define _Py_INIT_FAILED(err) \ (err.msg != NULL) @@ -42,11 +42,6 @@ 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(_PyInitError) _Py_GetPythonHomeWithConfig( - const _PyMainInterpreterConfig *config, - wchar_t **home); -#endif #ifndef Py_LIMITED_API /* Only used by applications that embed the interpreter and need to @@ -58,7 +53,11 @@ PyAPI_FUNC(int) Py_SetStandardStreamEncoding(const char *encoding, /* PEP 432 Multi-phase initialization API (Private while provisional!) */ PyAPI_FUNC(_PyInitError) _Py_InitializeCore(const _PyCoreConfig *); PyAPI_FUNC(int) _Py_IsCoreInitialized(void); -PyAPI_FUNC(_PyInitError) _Py_ReadMainInterpreterConfig(_PyMainInterpreterConfig *); + +PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_Read(_PyMainInterpreterConfig *); +PyAPI_FUNC(_PyInitError) _PyMainInterpreterConfig_ReadEnv(_PyMainInterpreterConfig *); +PyAPI_FUNC(void) _PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *); + PyAPI_FUNC(_PyInitError) _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *); #endif |