MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / leanpy_debug_rc

Function leanpy_debug_rc

LeanPy/native/python_bridge.c:55–61  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

53 * b_lean_obj_arg signals borrowed semantics.
54 */
55LEAN_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 */

Callers

nothing calls this directly

Calls 2

lean_is_scalarFunction · 0.85
lean_boxFunction · 0.85

Tested by

no test coverage detected