diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h index 33980e24d2833e..e059d6a659dd66 100644 --- a/Include/internal/pycore_runtime.h +++ b/Include/internal/pycore_runtime.h @@ -55,40 +55,50 @@ typedef struct _Py_AuditHookEntry { typedef struct _Py_DebugOffsets { // Runtime state offset; - off_t rs_finalizing; - off_t rs_interpreters_head; + struct _runtime_state { + off_t finalizing; + off_t interpreters_head; + } runtime_state; // Interpreter state offset; - off_t is_next; - off_t is_threads_head; - off_t is_gc; - off_t is_imports_modules; - off_t is_sysdict; - off_t is_builtins; - off_t is_ceval_gil; + struct _interpreter_state { + off_t next; + off_t threads_head; + off_t gc; + off_t imports_modules; + off_t sysdict; + off_t builtins; + off_t ceval_gil; + } interpreter_state; // Thread state offset; - off_t ts_prev; - off_t ts_next; - off_t ts_interp; - off_t ts_cframe; - off_t ts_thread_id; + struct _thread_state{ + off_t prev; + off_t next; + off_t interp; + off_t cframe; + off_t thread_id; + } thread_state; // Frame object offset; - off_t fo_previous; - off_t fo_executable; - off_t fo_prev_instr; - off_t fo_localsplus; - off_t fo_owner; + struct _frame_object { + off_t previous; + off_t executable; + off_t prev_instr; + off_t localsplus; + off_t owner; + } frame_object; // Code object offset; - off_t co_filename; - off_t co_name; - off_t co_linetable; - off_t co_firstlineno; - off_t co_argcount; - off_t co_localsplusnames; - off_t co_co_code_adaptive; + struct _code_object { + off_t filename; + off_t name; + off_t linetable; + off_t firstlineno; + off_t argcount; + off_t localsplusnames; + off_t co_code_adaptive; + } code_object; } _Py_DebugOffsets; /* Full Python runtime state */ diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h index f251f62c00c50b..421c8bad08e421 100644 --- a/Include/internal/pycore_runtime_init.h +++ b/Include/internal/pycore_runtime_init.h @@ -24,36 +24,42 @@ extern PyTypeObject _PyExc_MemoryError; #define _PyRuntimeState_INIT(runtime) \ { \ .debug_offsets = { \ - .rs_finalizing = offsetof(_PyRuntimeState, _finalizing), \ - .rs_interpreters_head = offsetof(_PyRuntimeState, interpreters.head), \ - \ - .is_next = offsetof(PyInterpreterState, next), \ - .is_threads_head = offsetof(PyInterpreterState, threads.head), \ - .is_gc = offsetof(PyInterpreterState, gc), \ - .is_imports_modules = offsetof(PyInterpreterState, imports.modules), \ - .is_sysdict = offsetof(PyInterpreterState, sysdict), \ - .is_builtins = offsetof(PyInterpreterState, builtins), \ - .is_ceval_gil = offsetof(PyInterpreterState, ceval.gil), \ - \ - .ts_prev = offsetof(PyThreadState, prev), \ - .ts_next = offsetof(PyThreadState, next), \ - .ts_interp = offsetof(PyThreadState, interp), \ - .ts_cframe = offsetof(PyThreadState, cframe), \ - .ts_thread_id = offsetof(PyThreadState, thread_id), \ - \ - .fo_previous = offsetof(_PyInterpreterFrame, previous), \ - .fo_executable = offsetof(_PyInterpreterFrame, f_executable), \ - .fo_prev_instr = offsetof(_PyInterpreterFrame, prev_instr), \ - .fo_localsplus = offsetof(_PyInterpreterFrame, localsplus), \ - .fo_owner = offsetof(_PyInterpreterFrame, owner), \ - \ - .co_filename = offsetof(PyCodeObject, co_filename), \ - .co_name = offsetof(PyCodeObject, co_name), \ - .co_linetable = offsetof(PyCodeObject, co_linetable), \ - .co_firstlineno = offsetof(PyCodeObject, co_firstlineno), \ - .co_argcount = offsetof(PyCodeObject, co_argcount), \ - .co_localsplusnames = offsetof(PyCodeObject, co_localsplusnames), \ - .co_co_code_adaptive = offsetof(PyCodeObject, co_code_adaptive), \ + .runtime_state = { \ + .finalizing = offsetof(_PyRuntimeState, _finalizing), \ + .interpreters_head = offsetof(_PyRuntimeState, interpreters.head), \ + }, \ + .interpreter_state = { \ + .next = offsetof(PyInterpreterState, next), \ + .threads_head = offsetof(PyInterpreterState, threads.head), \ + .gc = offsetof(PyInterpreterState, gc), \ + .imports_modules = offsetof(PyInterpreterState, imports.modules), \ + .sysdict = offsetof(PyInterpreterState, sysdict), \ + .builtins = offsetof(PyInterpreterState, builtins), \ + .ceval_gil = offsetof(PyInterpreterState, ceval.gil), \ + }, \ + .thread_state = { \ + .prev = offsetof(PyThreadState, prev), \ + .next = offsetof(PyThreadState, next), \ + .interp = offsetof(PyThreadState, interp), \ + .cframe = offsetof(PyThreadState, cframe), \ + .thread_id = offsetof(PyThreadState, thread_id), \ + }, \ + .frame_object = { \ + .previous = offsetof(_PyInterpreterFrame, previous), \ + .executable = offsetof(_PyInterpreterFrame, f_executable), \ + .prev_instr = offsetof(_PyInterpreterFrame, prev_instr), \ + .localsplus = offsetof(_PyInterpreterFrame, localsplus), \ + .owner = offsetof(_PyInterpreterFrame, owner), \ + }, \ + .code_object = { \ + .filename = offsetof(PyCodeObject, co_filename), \ + .name = offsetof(PyCodeObject, co_name), \ + .linetable = offsetof(PyCodeObject, co_linetable), \ + .firstlineno = offsetof(PyCodeObject, co_firstlineno), \ + .argcount = offsetof(PyCodeObject, co_argcount), \ + .localsplusnames = offsetof(PyCodeObject, co_localsplusnames), \ + .co_code_adaptive = offsetof(PyCodeObject, co_code_adaptive), \ + }, \ }, \ .allocators = { \ .standard = _pymem_allocators_standard_INIT(runtime), \