(self, makeref)
| 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 |
no test coverage detected