summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-22 21:58:50 (GMT)
committerGitHub <noreply@github.com>2019-05-22 21:58:50 (GMT)
commit022be02dcfdfd9011415804bb4553a33fa7ec8f3 (patch)
tree6c4f3b4afed8475e6504786cb176044eade9ef02 /Python/pystate.c
parente4d300e07c33a9a77549c62d8687d8fe130c53d5 (diff)
downloadcpython-022be02dcfdfd9011415804bb4553a33fa7ec8f3.zip
cpython-022be02dcfdfd9011415804bb4553a33fa7ec8f3.tar.gz
cpython-022be02dcfdfd9011415804bb4553a33fa7ec8f3.tar.bz2
bpo-36763: Add _PyPreConfig._config_init (GH-13481)
* _PyPreConfig_GetGlobalConfig() and _PyCoreConfig_GetGlobalConfig() now do nothing if the configuration was not initialized with _PyPreConfig_InitCompatConfig() and _PyCoreConfig_InitCompatConfig() * Remove utf8_mode=-2 special case: use utf8_mode=-1 instead. * Fix _PyPreConfig_InitPythonConfig(): * isolated = 0 instead of -1 * use_environment = 1 instead of -1 * Rename _PyConfig_INIT to _PyConfig_INIT_COMPAT * Rename _PyPreConfig_Init() to _PyPreConfig_InitCompatConfig() * Rename _PyCoreConfig_Init() to _PyCoreConfig_InitCompatConfig() * PyInterpreterState_New() now uses _PyCoreConfig_InitPythonConfig() as default configuration, but it's very quickly overriden anyway. * _freeze_importlib.c uses _PyCoreConfig_SetString() to set program_name. * Cleanup preconfig_init_utf8_mode(): cmdline is always non-NULL.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 2f80aa2..879a5a9 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -49,7 +49,7 @@ _PyRuntimeState_Init_impl(_PyRuntimeState *runtime)
_PyGC_Initialize(&runtime->gc);
_PyEval_Initialize(&runtime->ceval);
- _PyPreConfig_Init(&runtime->preconfig);
+ _PyPreConfig_InitPythonConfig(&runtime->preconfig);
runtime->gilstate.check_enabled = 1;
@@ -189,7 +189,13 @@ PyInterpreterState_New(void)
memset(interp, 0, sizeof(*interp));
interp->id_refcount = -1;
interp->check_interval = 100;
- _PyCoreConfig_Init(&interp->core_config);
+
+ _PyInitError err = _PyCoreConfig_InitPythonConfig(&interp->core_config);
+ if (_Py_INIT_FAILED(err)) {
+ PyMem_RawFree(interp);
+ return NULL;
+ }
+
interp->eval_frame = _PyEval_EvalFrameDefault;
#ifdef HAVE_DLOPEN
#if HAVE_DECL_RTLD_NOW