Lean's `Int` may be a small scalar or a big integer (mpz). For now we * support the int64 range and error otherwise; this is what 99% of API * surface needs. Callers needing arbitrary precision can stringify. */
| 482 | /* Conversions: Lean → Python */ |
| 483 | /* ------------------------------------------------------------------ */ |
| 484 | |
| 485 | LEAN_EXPORT lean_obj_res lean_py_of_bool(uint8_t b, lean_obj_arg world) { |
| 486 | (void)world; ENSURE_INIT(); WITH_GIL(); |
| 487 | return ok_owned_or_err(p_PyBool_FromLong(b ? 1 : 0)); |
| 488 | } |
| 489 | |
| 490 | /* Lean's `Int` may be a small scalar or a big integer (mpz). For now we |
| 491 | * support the int64 range and error otherwise; this is what 99% of API |
| 492 | * surface needs. Callers needing arbitrary precision can stringify. */ |
| 493 | LEAN_EXPORT lean_obj_res lean_py_of_int64(b_lean_obj_arg n, lean_obj_arg world) { |
| 494 | (void)world; ENSURE_INIT(); WITH_GIL(); |
| 495 | long long v; |
| 496 | if (lean_is_scalar(n)) { |
| 497 | v = (long long) lean_scalar_to_int64(n); |
nothing calls this directly
no test coverage detected