MCPcopy Index your code
hub / github.com/python/cpython / test_get_objects

Method test_get_objects

Lib/test/test_free_threading/test_gc.py:17–35  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15@threading_helper.requires_working_threading()
16class TestGC(TestCase):
17 def test_get_objects(self):
18 event = threading.Event()
19
20 def gc_thread():
21 for i in range(100):
22 o = gc.get_objects()
23 event.set()
24
25 def mutator_thread():
26 while not event.is_set():
27 o1 = MyObj()
28 o2 = MyObj()
29 o3 = MyObj()
30 o4 = MyObj()
31
32 gcs = [Thread(target=gc_thread)]
33 mutators = [Thread(target=mutator_thread) for _ in range(4)]
34 with threading_helper.start_threads(gcs + mutators):
35 pass
36
37 def test_get_referrers(self):
38 NUM_GC = 2

Callers

nothing calls this directly

Calls 2

ThreadClass · 0.90
EventMethod · 0.80

Tested by

no test coverage detected