summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/internal/pycore_runtime.h')
-rw-r--r--Include/internal/pycore_runtime.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index bd88510..725c859 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -8,10 +8,10 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
-#include "pycore_atomic.h" /* _Py_atomic_address */
-#include "pycore_gil.h" // struct _gil_runtime_state
-#include "pycore_long_state.h" // struct _Py_long_state
-#include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids
+#include "pycore_atomic.h" /* _Py_atomic_address */
+#include "pycore_gil.h" // struct _gil_runtime_state
+#include "pycore_global_objects.h" // struct _Py_global_objects
+#include "pycore_unicodeobject.h" // struct _Py_unicode_runtime_ids
/* ceval state */
@@ -101,8 +101,6 @@ typedef struct pyruntimestate {
unsigned long main_thread;
- struct _Py_long_state int_state;
-
#define NEXITFUNCS 32
void (*exitfuncs[NEXITFUNCS])(void);
int nexitfuncs;
@@ -120,12 +118,14 @@ typedef struct pyruntimestate {
struct _Py_unicode_runtime_ids unicode_ids;
- // XXX Consolidate globals found via the check-c-globals script.
+ struct _Py_global_objects global_objects;
+ // If anything gets added after global_objects then
+ // _PyRuntimeState_reset() needs to get updated to clear it.
} _PyRuntimeState;
#define _PyRuntimeState_INIT \
{ \
- ._initialized = 0, \
+ .global_objects = _Py_global_objects_INIT, \
}
/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */
@@ -133,7 +133,8 @@ static inline void
_PyRuntimeState_reset(_PyRuntimeState *runtime)
{
/* Make it match _PyRuntimeState_INIT. */
- memset(runtime, 0, sizeof(*runtime));
+ memset(runtime, 0, (size_t)&runtime->global_objects - (size_t)runtime);
+ _Py_global_objects_reset(&runtime->global_objects);
}