summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_interp.h6
-rw-r--r--Include/internal/pycore_runtime.h17
2 files changed, 21 insertions, 2 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 53938e3..e421aa4 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -240,7 +240,6 @@ struct _is {
struct _is *next;
struct pythreads {
- int _preallocated_used;
uint64_t next_unique_id;
struct _ts *head;
/* Used in Modules/_threadmodule.c. */
@@ -262,6 +261,11 @@ struct _is {
int requires_idref;
PyThread_type_lock id_mutex;
+ /* Has been initialized to a safe state.
+
+ In order to be effective, this must be set to 0 during or right
+ after allocation. */
+ int _initialized;
int finalizing;
struct _ceval_state ceval;
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 9df833c..39e30b7 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -67,6 +67,12 @@ struct _Py_unicode_runtime_ids {
/* Full Python runtime state */
typedef struct pyruntimestate {
+ /* Has been initialized to a safe state.
+
+ In order to be effective, this must be set to 0 during or right
+ after allocation. */
+ int _initialized;
+
/* Is running Py_PreInitialize()? */
int preinitializing;
@@ -136,9 +142,18 @@ typedef struct pyruntimestate {
} _PyRuntimeState;
#define _PyRuntimeState_INIT \
- {.preinitialized = 0, .core_initialized = 0, .initialized = 0}
+ { \
+ ._initialized = 0, \
+ }
/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */
+static inline void
+_PyRuntimeState_reset(_PyRuntimeState *runtime)
+{
+ /* Make it match _PyRuntimeState_INIT. */
+ memset(runtime, 0, sizeof(*runtime));
+}
+
PyAPI_DATA(_PyRuntimeState) _PyRuntime;