bpo-38070: Add _PyRuntimeState.preinitializing (GH-16245)

Add _PyRuntimeState.preinitializing field: set to 1 while
Py_PreInitialize() is running.

_PyRuntimeState: rename also pre_initialized field to preinitialized.
This commit is contained in:
Victor Stinner 2019-09-17 23:59:51 +02:00 committed by GitHub
parent b39afb7876
commit d3b904144e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View file

@ -190,8 +190,11 @@ struct _gilstate_runtime_state {
/* Full Python runtime state */
typedef struct pyruntimestate {
/* Is Python pre-initialized? Set to 1 by Py_PreInitialize() */
int pre_initialized;
/* Is running Py_PreInitialize()? */
int preinitializing;
/* Is Python preinitialized? Set to 1 by Py_PreInitialize() */
int preinitialized;
/* Is Python core initialized? Set to 1 by _Py_InitializeCore() */
int core_initialized;
@ -199,6 +202,8 @@ typedef struct pyruntimestate {
/* Is Python fully initialized? Set to 1 by Py_Initialize() */
int initialized;
/* Set by Py_FinalizeEx(). Only reset to NULL if Py_Initialize()
is called again. */
PyThreadState *finalizing;
struct pyinterpreters {
@ -241,7 +246,7 @@ typedef struct pyruntimestate {
} _PyRuntimeState;
#define _PyRuntimeState_INIT \
{.pre_initialized = 0, .core_initialized = 0, .initialized = 0}
{.preinitialized = 0, .core_initialized = 0, .initialized = 0}
/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */
PyAPI_DATA(_PyRuntimeState) _PyRuntime;