summaryrefslogtreecommitdiffstats
path: root/Python/coreconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-20 01:20:13 (GMT)
committerGitHub <noreply@github.com>2019-03-20 01:20:13 (GMT)
commitf29084d611a6ca504c99a0967371374febf0ccc3 (patch)
tree4026d6cf02a675a3b34aa5e6b6d9e832cb1830a5 /Python/coreconfig.c
parent0d765e3849f1010276bb349b557b79ed94befa0b (diff)
downloadcpython-f29084d611a6ca504c99a0967371374febf0ccc3.zip
cpython-f29084d611a6ca504c99a0967371374febf0ccc3.tar.gz
cpython-f29084d611a6ca504c99a0967371374febf0ccc3.tar.bz2
bpo-36301: Add _PyRuntime.pre_initialized (GH-12457)
* Add _PyRuntime.pre_initialized: set to 1 when Python is pre-initialized * Add _Py_PreInitialize() and _Py_PreInitializeFromPreConfig(). * _PyCoreConfig_Read() now calls _Py_PreInitialize(). * Move _PyPreConfig_GetGlobalConfig() and _PyCoreConfig_GetGlobalConfig() calls from main.c to preconfig.c and coreconfig.c.
Diffstat (limited to 'Python/coreconfig.c')
-rw-r--r--Python/coreconfig.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/coreconfig.c b/Python/coreconfig.c
index 0827376..de2058c 100644
--- a/Python/coreconfig.c
+++ b/Python/coreconfig.c
@@ -1367,6 +1367,11 @@ _PyCoreConfig_Read(_PyCoreConfig *config, const _PyPreConfig *preconfig)
{
_PyInitError err;
+ err = _Py_PreInitialize();
+ if (_Py_INIT_FAILED(err)) {
+ return err;
+ }
+
_PyCoreConfig_GetGlobalConfig(config);
if (preconfig != NULL) {
@@ -2025,6 +2030,8 @@ config_from_cmdline(_PyCoreConfig *config, _PyCmdline *cmdline,
int need_usage = 0;
_PyInitError err;
+ _PyCoreConfig_GetGlobalConfig(config);
+
err = config_init_program(config, cmdline);
if (_Py_INIT_FAILED(err)) {
return err;