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

Function leanpy_is_lean_obj_handle

LeanPy/native/python_bridge.c:1242–1251  ·  view source on GitHub ↗

* leanpy_is_lean_obj_handle: Python-side helper to check whether a * lean_object* (seen through the Py external class) wraps a LeanObjHandle. * Returns the inner lean_object* pointer value, or 0 if not a handle. */

Source from the content-addressed store, hash-verified

1240 lean_object *some = lean_alloc_ctor(1, 1, 0);
1241 lean_ctor_set(some, 0, result);
1242 return lean_io_result_mk_ok(some);
1243}
1244
1245/*
1246 * leanpy_is_lean_obj_handle: Python-side helper to check whether a
1247 * lean_object* (seen through the Py external class) wraps a LeanObjHandle.
1248 * Returns the inner lean_object* pointer value, or 0 if not a handle.
1249 */
1250LEAN_EXPORT uintptr_t leanpy_is_lean_obj_handle(b_lean_obj_arg py_ext) {
1251 if (!py_initialized || !lean_is_external(py_ext)) return 0;
1252 PyObject *pyobj = unwrap_pyobject(py_ext);
1253 if (!pyobj) return 0;
1254 PyObject *ht = get_lean_obj_handle_type();

Callers

nothing calls this directly

Calls 3

lean_is_externalFunction · 0.85
unwrap_pyobjectFunction · 0.85
get_lean_obj_handle_typeFunction · 0.85

Tested by

no test coverage detected