Pure Python LeanObj wrappers should release their refs on GC.
(example_lib)
| 84 | |
| 85 | |
| 86 | def test_leanobj_handle_dropping(example_lib): |
| 87 | """Pure Python LeanObj wrappers should release their refs on GC.""" |
| 88 | from lean_py import LeanObj |
| 89 | from lean_py.lean_ffi import get_lean_ffi |
| 90 | |
| 91 | ffi = get_lean_ffi() |
| 92 | |
| 93 | # Allocate / drop in a loop and ensure no exceptions. |
| 94 | for _ in range(5_000): |
| 95 | s = ffi.mk_string("hello") |
| 96 | wrapper = LeanObj(s) |
| 97 | del wrapper |
| 98 | gc.collect() |
| 99 | |
| 100 | |
| 101 | def test_lean_expr_round_trip_no_leak(example_lib): |
nothing calls this directly
no test coverage detected