1 from __future__
import annotations
9 from pybind11_tests
import custom_type_setup
as m
14 """Tests that an object is garbage collected.
16 Assumes that any unreferenced objects are fully collected after calling
17 `gc.collect()`. That is true on CPython, but does not appear to reliably
26 assert gc.is_tracked(obj)
27 weak_refs.append(weakref.ref(obj))
37 @pytest.mark.skipif(
"env.PYPY")
39 obj = m.OwnsPythonObjects()
45 @pytest.mark.skipif(
"env.PYPY")
47 obj = m.OwnsPythonObjects()