(x: Any, expected_count: int)
| 181 | use_count = tvm_ffi.get_global_func("testing.object_use_count") |
| 182 | |
| 183 | def callback(x: Any, expected_count: int) -> Any: |
| 184 | # The use count of TVM FFI objects is decremented as part of |
| 185 | # `ObjectRef.__del__`, which runs when the Python object is |
| 186 | # destructed. However, Python object destruction is not |
| 187 | # deterministic, and even CPython's reference-counting is |
| 188 | # considered an implementation detail. Therefore, to ensure |
| 189 | # correct results from this test, `gc.collect()` must be |
| 190 | # explicitly called. |
| 191 | gc.collect() |
| 192 | assert expected_count == use_count(x) |
| 193 | return x._move() |
| 194 | |
| 195 | f = tvm_ffi.convert(callback) |
| 196 |
no outgoing calls
no test coverage detected