(self, o, i)
| 465 | return self.lean_ptr_other(o) |
| 466 | |
| 467 | def lean_ctor_get(self, o, i): |
| 468 | ctor_cls = structs.get("lean_ctor_object") |
| 469 | ctor = ctypes.cast(o, POINTER(ctor_cls)) |
| 470 | offset = ctor_cls.m_objs.offset |
| 471 | # Read the pointer value as an integer to avoid creating a ctypes |
| 472 | # pointer that aliases into the Lean ctor's m_objs memory. If the |
| 473 | # ctor is later freed (lean_dec), an aliased pointer would become |
| 474 | # stale when the Lean allocator reuses the memory. |
| 475 | elem_addr = ctypes.addressof(ctor.contents) + offset + i * ctypes.sizeof(LeanObjectPtr) |
| 476 | raw_val = c_void_p.from_address(elem_addr).value or 0 |
| 477 | return ctypes.cast(c_void_p(raw_val), LeanObjectPtr) |
| 478 | |
| 479 | def lean_ctor_set(self, o, i, v): |
| 480 | ctor_cls = structs.get("lean_ctor_object") |
no test coverage detected