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

Function test_leanobj_handle_dropping

tests/test_memory.py:86–98  ·  view source on GitHub ↗

Pure Python LeanObj wrappers should release their refs on GC.

(example_lib)

Source from the content-addressed store, hash-verified

84
85
86def 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
101def test_lean_expr_round_trip_no_leak(example_lib):

Callers

nothing calls this directly

Calls 2

LeanObjClass · 0.90
get_lean_ffiFunction · 0.85

Tested by

no test coverage detected