Author: Armin Rigo <[email protected]>
Branch: finalizer
Changeset: r1461:453148969a4a
Date: 2014-10-06 16:11 +0200
http://bitbucket.org/pypy/stmgc/changeset/453148969a4a/
Log: in-progress
diff --git a/c7/stm/finalizer.c b/c7/stm/finalizer.c
--- a/c7/stm/finalizer.c
+++ b/c7/stm/finalizer.c
@@ -14,7 +14,14 @@
long i, count = list_count(lst);
for (i = 0; i < count; i++) {
object_t* obj = (object_t *)list_item(lst, i);
- stmcb_light_finalizer(obj);
+ object_t *TLPREFIX *pforwarded_array = (object_t *TLPREFIX *)obj;
+ if (pforwarded_array[0] != GCWORD_MOVED) {
+ /* not moved: the object dies */
+ stmcb_light_finalizer(obj);
+ }
+ else {
+ /*...*/
+ }
}
list_clear(lst);
}
diff --git a/c7/test/test_finalizer.py b/c7/test/test_finalizer.py
--- a/c7/test/test_finalizer.py
+++ b/c7/test/test_finalizer.py
@@ -31,3 +31,11 @@
self.expect_finalized([])
self.commit_transaction()
self.expect_finalized([lp1])
+
+ def test_young_light_finalizer_dont_die(self):
+ self.start_transaction()
+ lp1 = stm_allocate(48)
+ lib.stm_enable_light_finalizer(lp1)
+ self.push_root(lp1) # stays alive
+ self.commit_transaction()
+ self.expect_finalized([])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit