I need to write a function that returns an object by its id. I can't use ctypes.cast, _ctypes, gc, locals, globals, etc., it is recommended to use struct and ctypes. For example, for an object of type int, I write the following:
struct.unpack ("LLli", ctypes.string_at (id_of_object, 28))
if i know the size of the object is 28 bytes. But the object can be of any size. For example, for object = 2**30 the size will be 32 bytes. Can I somehow get the size of the object itself by its id? Or do I need to use some other methods in this task?