MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_gc_during_creation

Method check_gc_during_creation

Lib/test/test_weakref.py:850–873  ·  view source on GitHub ↗
(self, makeref)

Source from the content-addressed store, hash-verified

848 self.check_gc_during_creation(weakref.proxy)
849
850 def check_gc_during_creation(self, makeref):
851 thresholds = gc.get_threshold()
852 gc.set_threshold(1, 1, 1)
853 gc.collect()
854 class A:
855 pass
856
857 def callback(*args):
858 pass
859
860 referenced = A()
861
862 a = A()
863 a.a = a
864 a.wr = makeref(referenced)
865
866 try:
867 # now make sure the object and the ref get labeled as
868 # cyclic trash:
869 a = A()
870 weakref.ref(referenced, callback)
871
872 finally:
873 gc.set_threshold(*thresholds)
874
875 def test_ref_created_during_del(self):
876 # Bug #1377858

Calls 4

get_thresholdMethod · 0.80
set_thresholdMethod · 0.80
collectMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected