Skip to content

Commit

Permalink
Add new offsets fields for 3.13
Browse files Browse the repository at this point in the history
In Python 3.13.0b4 the offsets structure had some extra fields and we
need to update our vendored headers to account for those.

Signed-off-by: Pablo Galindo <[email protected]>
  • Loading branch information
pablogsal committed Jul 23, 2024
1 parent 44f4161 commit b979c12
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/pystack/_pystack/cpython/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,16 @@ typedef struct _Py_DebugOffsets
// Runtime state offset;
struct _runtime_state
{
uint64_t size;
uint64_t finalizing;
uint64_t interpreters_head;
} runtime_state;

// Interpreter state offset;
struct _interpreter_state
{
uint64_t size;
uint64_t id;
uint64_t next;
uint64_t threads_head;
uint64_t gc;
Expand All @@ -276,36 +279,35 @@ typedef struct _Py_DebugOffsets
// Thread state offset;
struct _thread_state
{
uint64_t size;
uint64_t prev;
uint64_t next;
uint64_t interp;
uint64_t current_frame;
uint64_t thread_id;
uint64_t native_thread_id;
uint64_t datastack_chunk;
uint64_t status;
} thread_state;

// InterpreterFrame offset;
struct _interpreter_frame
{
uint64_t size;
uint64_t previous;
uint64_t executable;
uint64_t instr_ptr;
uint64_t localsplus;
uint64_t owner;
} interpreter_frame;

// CFrame offset;
struct _cframe
{
uint64_t current_frame;
uint64_t previous;
} cframe;

// Code object offset;
struct _code_object
{
uint64_t size;
uint64_t filename;
uint64_t name;
uint64_t qualname;
uint64_t linetable;
uint64_t firstlineno;
uint64_t argcount;
Expand All @@ -317,28 +319,39 @@ typedef struct _Py_DebugOffsets
// PyObject offset;
struct _pyobject
{
uint64_t size;
uint64_t ob_type;
} pyobject;

// PyTypeObject object offset;
struct _type_object
{
uint64_t size;
uint64_t tp_name;
} type_object;

// PyTuple object offset;
struct _tuple_object
{
uint64_t size;
uint64_t ob_item;
} tuple_object;

// Unicode object offset;
struct _unicode_object
{
uint64_t size;
uint64_t state;
uint64_t length;
size_t asciiobject_size;
} unicode_object;

// GC runtime state offset;
struct _gc
{
uint64_t size;
uint64_t collecting;
} gc;
} _Py_DebugOffsets;

typedef struct pyruntimestate
Expand Down

0 comments on commit b979c12

Please sign in to comment.