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

Method evil

Lib/test/test_free_threading/test_gc.py:78–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 weird = Weird()
77
78 def evil():
79 gc.freeze()
80
81 # Decrement the reference count from this thread, which will trigger the
82 # slow path during resurrection and add our weird object to the BRC queue.
83 nonlocal weird
84 del weird
85
86 # Collection will merge the object's reference count and make it zero.
87 gc.collect()
88
89 # Unfreeze the object, making it visible to the GC.
90 gc.unfreeze()
91 gc.collect()
92
93 thread = Thread(target=evil)
94 thread.start()

Callers

nothing calls this directly

Calls 2

freezeMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected