Author: Armin Rigo <[email protected]>
Branch: gc-del-2
Changeset: r66074:42875d86bea5
Date: 2013-08-11 18:12 +0200
http://bitbucket.org/pypy/pypy/changeset/42875d86bea5/

Log:    The first test to pass would be this: record and detect young
        objects with (non-light) finalizers

diff --git a/rpython/memory/test/test_minimark_gc.py 
b/rpython/memory/test/test_minimark_gc.py
--- a/rpython/memory/test/test_minimark_gc.py
+++ b/rpython/memory/test/test_minimark_gc.py
@@ -13,6 +13,22 @@
     GC_CAN_MALLOC_NONMOVABLE = True
     BUT_HOW_BIG_IS_A_BIG_STRING = 11*WORD
 
+    def test_finalizer_young_obj(self):
+        class A:
+            def __del__(self):
+                state.seen += 1
+        class State:
+            pass
+        state = State()
+
+        def f():
+            state.seen = 0
+            A(); A()
+            rgc.collect(0)    # minor collection only
+            return state.seen
+
+        assert self.interpret(f, []) == 2
+
     def test_finalizer_chain_minor_collect(self):
         class A:
             def __init__(self, n, next):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to