diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-20 01:20:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 01:20:13 (GMT) |
commit | f29084d611a6ca504c99a0967371374febf0ccc3 (patch) | |
tree | 4026d6cf02a675a3b34aa5e6b6d9e832cb1830a5 /Include/internal | |
parent | 0d765e3849f1010276bb349b557b79ed94befa0b (diff) | |
download | cpython-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 'Include/internal')
-rw-r--r-- | Include/internal/pycore_pystate.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Include/internal/pycore_pystate.h b/Include/internal/pycore_pystate.h index 7c9d11a..911e7ee 100644 --- a/Include/internal/pycore_pystate.h +++ b/Include/internal/pycore_pystate.h @@ -134,8 +134,15 @@ struct _gilstate_runtime_state { /* Full Python runtime state */ typedef struct pyruntimestate { - int initialized; + /* Is Python pre-initialized? Set to 1 by _Py_PreInitialize() */ + int pre_initialized; + + /* Is Python core initialized? Set to 1 by _Py_InitializeCore() */ int core_initialized; + + /* Is Python fully initialized? Set to 1 by Py_Initialize() */ + int initialized; + PyThreadState *finalizing; struct pyinterpreters { @@ -172,7 +179,8 @@ typedef struct pyruntimestate { // XXX Consolidate globals found via the check-c-globals script. } _PyRuntimeState; -#define _PyRuntimeState_INIT {.initialized = 0, .core_initialized = 0} +#define _PyRuntimeState_INIT \ + {.pre_initialized = 0, .core_initialized = 0, .initialized = 0} /* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */ PyAPI_DATA(_PyRuntimeState) _PyRuntime; |