GH-115776: Allow any fixed sized object to have inline values (GH-123192)

This commit is contained in:
Mark Shannon 2024-08-21 15:52:04 +01:00 committed by GitHub
parent 4b7c4880a0
commit a4fd7aa4a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 61 additions and 38 deletions

View file

@ -69,9 +69,6 @@ def _type_unsigned_int_ptr():
def _sizeof_void_p():
return gdb.lookup_type('void').pointer().sizeof
def _sizeof_pyobject():
return gdb.lookup_type('PyObject').sizeof
def _managed_dict_offset():
# See pycore_object.h
pyobj = gdb.lookup_type("PyObject")
@ -505,7 +502,7 @@ class HeapTypeObjectPtr(PyObjectPtr):
dict_ptr = dict_ptr_ptr.cast(_type_char_ptr().pointer()).dereference()
if int(dict_ptr):
return None
char_ptr = obj_ptr + _sizeof_pyobject()
char_ptr = obj_ptr + typeobj.field('tp_basicsize')
values_ptr = char_ptr.cast(gdb.lookup_type("PyDictValues").pointer())
values = values_ptr['values']
return PyKeysValuesPair(self.get_cached_keys(), values)