Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Include/internal/pycore_debug_offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,16 @@ typedef struct _Py_DebugOffsets {
uint64_t tp_name;
uint64_t tp_repr;
uint64_t tp_flags;
uint64_t tp_basicsize;
uint64_t tp_dictoffset;
} type_object;

// PyHeapTypeObject offset;
struct _heap_type_object {
uint64_t size;
uint64_t ht_cached_keys;
} heap_type_object;

// PyTuple object offset;
struct _tuple_object {
uint64_t size;
Expand Down Expand Up @@ -329,6 +337,12 @@ typedef struct _Py_DebugOffsets {
.tp_name = offsetof(PyTypeObject, tp_name), \
.tp_repr = offsetof(PyTypeObject, tp_repr), \
.tp_flags = offsetof(PyTypeObject, tp_flags), \
.tp_basicsize = offsetof(PyTypeObject, tp_basicsize), \
.tp_dictoffset = offsetof(PyTypeObject, tp_dictoffset), \
}, \
.heap_type_object = { \
.size = sizeof(PyHeapTypeObject), \
.ht_cached_keys = offsetof(PyHeapTypeObject, ht_cached_keys), \
}, \
.tuple_object = { \
.size = sizeof(PyTupleObject), \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Added ``PyTypeObject.tp_basicsize``, ``PyTypeObject.tp_dictoffset``, and
``PyHeapTypeObject.ht_cached_keys`` offsets to :c:type:`!_Py_DebugOffsets` to
support version-independent read-only dict introspection tools.
2 changes: 1 addition & 1 deletion Modules/_remote_debugging/debug_offsets_validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define FIELD_SIZE(type, member) sizeof(((type *)0)->member)

enum {
PY_REMOTE_DEBUG_OFFSETS_TOTAL_SIZE = 840,
PY_REMOTE_DEBUG_OFFSETS_TOTAL_SIZE = 872,
PY_REMOTE_ASYNC_DEBUG_OFFSETS_TOTAL_SIZE = 104,
};

Expand Down
Loading