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.
This commit is contained in:
Victor Stinner 2019-03-20 02:20:13 +01:00 committed by GitHub
parent 0d765e3849
commit f29084d611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 27 deletions

View file

@ -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;