]> granicus.if.org Git - python/commitdiff
further testing indicates that the simplified version of the test
authorFred Drake <fdrake@acm.org>
Fri, 13 Feb 2004 19:21:57 +0000 (19:21 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 13 Feb 2004 19:21:57 +0000 (19:21 +0000)
(re-using an existing test object class) no longer triggered the
original segfault when the fix was backed out; restoring the local
test object class to make the test effective

the assignment of the ref created at the end does not affect the test,
since the segfault happended before weakref.ref() returned; removing
the assignment

Lib/test/test_weakref.py

index 9ec607eb891eaa10b8a0b68e261d945a7c44c187..29243130e7a1e66fade6a2621358db6c990c855e 100644 (file)
@@ -602,21 +602,23 @@ class ReferencesTestCase(TestBase):
         thresholds = gc.get_threshold()
         gc.set_threshold(1, 1, 1)
         gc.collect()
+        class A:
+            pass
 
         def callback(*args):
             pass
 
-        referenced = C()
+        referenced = A()
 
-        a = C()
+        a = A()
         a.a = a
         a.wr = makeref(referenced)
 
         try:
             # now make sure the object and the ref get labeled as
             # cyclic trash:
-            a = C()
-            a.wrc = weakref.ref(referenced, callback)
+            a = A()
+            weakref.ref(referenced, callback)
 
         finally:
             gc.set_threshold(*thresholds)