* Debug helper: read the m_rc of a lean_object* passed from Python. * Called as: lib._cffi.leanpy_debug_rc(ptr) * Returns: lean_io_result_mk_ok(lean_box(m_rc)) * * Called from Python ctypes — the caller does NOT adjust the Lean * refcount before calling, so we must not consume the reference. * b_lean_obj_arg signals borrowed semantics. */
| 53 | * b_lean_obj_arg signals borrowed semantics. |
| 54 | */ |
| 55 | LEAN_EXPORT lean_obj_res leanpy_debug_rc(b_lean_obj_arg x, lean_obj_arg w) { |
| 56 | int rc = 0; |
| 57 | if (!lean_is_scalar(x)) { |
| 58 | rc = (int)x->m_rc; |
| 59 | } |
| 60 | return lean_io_result_mk_ok(lean_box((size_t)(unsigned)rc)); |
| 61 | } |
| 62 | |
| 63 | /* ------------------------------------------------------------------ */ |
| 64 | /* Forward-declared opaque CPython types */ |
nothing calls this directly
no test coverage detected