summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-01 13:22:52 (GMT)
committerGitHub <noreply@github.com>2019-05-01 13:22:52 (GMT)
commit1a9f0d8efded4bf37c864ed572beff28c43c7c77 (patch)
tree5ead40c23d01803d041465871c24e39cfcc48b37 /Python/pylifecycle.c
parent2fc936ed24cf04ed32f6015a8aa78c8ea40da66b (diff)
downloadcpython-1a9f0d8efded4bf37c864ed572beff28c43c7c77.zip
cpython-1a9f0d8efded4bf37c864ed572beff28c43c7c77.tar.gz
cpython-1a9f0d8efded4bf37c864ed572beff28c43c7c77.tar.bz2
bpo-36763: Add _PyCoreConfig_SetString() (GH-13035)
Add 3 new config methods: * _PyCoreConfig_SetString() * _PyCoreConfig_SetWideString() * _PyCoreConfig_SetWideStringFromString() Changes: * _PyCoreConfig_Copy() returns _PyInitError. * Add CONFIG_GET_ENV_DUP().
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index c874a50..afa683b 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -472,6 +472,7 @@ _Py_Initialize_ReconfigureCore(_PyRuntimeState *runtime,
PyInterpreterState **interp_p,
const _PyCoreConfig *core_config)
{
+ _PyInitError err;
PyThreadState *tstate = _PyThreadState_GET();
if (!tstate) {
return _Py_INIT_ERR("failed to read thread state");
@@ -485,13 +486,14 @@ _Py_Initialize_ReconfigureCore(_PyRuntimeState *runtime,
_PyCoreConfig_Write(core_config, runtime);
- if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) {
- return _Py_INIT_NO_MEMORY();
+ err = _PyCoreConfig_Copy(&interp->core_config, core_config);
+ if (_Py_INIT_FAILED(err)) {
+ return err;
}
core_config = &interp->core_config;
if (core_config->_install_importlib) {
- _PyInitError err = _PyCoreConfig_SetPathConfig(core_config);
+ err = _PyCoreConfig_SetPathConfig(core_config);
if (_Py_INIT_FAILED(err)) {
return err;
}
@@ -545,8 +547,9 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
}
*interp_p = interp;
- if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) {
- return _Py_INIT_NO_MEMORY();
+ _PyInitError err = _PyCoreConfig_Copy(&interp->core_config, core_config);
+ if (_Py_INIT_FAILED(err)) {
+ return err;
}
core_config = &interp->core_config;
@@ -804,8 +807,9 @@ pyinit_coreconfig(_PyRuntimeState *runtime,
_PyInitError err;
if (src_config) {
- if (_PyCoreConfig_Copy(config, src_config) < 0) {
- return _Py_INIT_NO_MEMORY();
+ err = _PyCoreConfig_Copy(config, src_config);
+ if (_Py_INIT_FAILED(err)) {
+ return err;
}
}
@@ -1433,8 +1437,9 @@ new_interpreter(PyThreadState **tstate_p)
core_config = &main_interp->core_config;
}
- if (_PyCoreConfig_Copy(&interp->core_config, core_config) < 0) {
- return _Py_INIT_NO_MEMORY();
+ err = _PyCoreConfig_Copy(&interp->core_config, core_config);
+ if (_Py_INIT_FAILED(err)) {
+ return err;
}
core_config = &interp->core_config;