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

Function lean_py_call

LeanPy/native/python_bridge.c:681–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

679}
680
681LEAN_EXPORT lean_obj_res lean_py_is(b_lean_obj_arg a, b_lean_obj_arg b, lean_obj_arg world) {
682 (void)world; ENSURE_INIT(); WITH_GIL();
683 return lean_io_result_mk_ok(lean_box(unwrap_pyobject(a) == unwrap_pyobject(b) ? 1 : 0));
684}
685
686/* ------------------------------------------------------------------ */
687/* Calling */
688/* ------------------------------------------------------------------ */
689
690LEAN_EXPORT lean_obj_res lean_py_call(b_lean_obj_arg f, b_lean_obj_arg args, lean_obj_arg world) {
691 (void)world; ENSURE_INIT(); WITH_GIL();
692 size_t n = lean_array_size(args);
693 PyObject *tup = p_PyTuple_New((Py_ssize_t)n);
694 if (!tup) return raise_py_error();
695 for (size_t i = 0; i < n; i++) {
696 PyObject *po = unwrap_pyobject(lean_array_get_core(args, i));
697 p_Py_IncRef(po);

Callers

nothing calls this directly

Calls 5

lean_array_sizeFunction · 0.85
raise_py_errorFunction · 0.85
unwrap_pyobjectFunction · 0.85
lean_array_get_coreFunction · 0.85
ok_owned_or_errFunction · 0.85

Tested by

no test coverage detected