Author: Armin Rigo <[email protected]>
Branch:
Changeset: r1087:2e0533b4f814
Date: 2014-03-24 18:38 +0100
http://bitbucket.org/pypy/stmgc/changeset/2e0533b4f814/
Log: Yay, managed to isolate (one of) the misbehavior of PyPy
diff --git a/c7/test/test_weakref.py b/c7/test/test_weakref.py
--- a/c7/test/test_weakref.py
+++ b/c7/test/test_weakref.py
@@ -314,3 +314,27 @@
assert stm_get_char(lp2, 10) == 'C'
assert stm_get_weakref(lp1) == ffi.NULL
assert stm_get_weakref(lp3) == lp2
+
+ def test_weakref_bug1(self):
+ self.start_transaction()
+ lp0 = stm_allocate(16)
+ self.push_root(lp0)
+ self.commit_transaction()
+ #
+ self.start_transaction()
+ lp0 = self.pop_root()
+ self.push_root(lp0)
+ stm_write(lp0) # privatize page
+ #
+ self.switch(1)
+ self.start_transaction()
+ lp1 = stm_allocate_weakref(lp0)
+ assert stm_get_weakref(lp1) == lp0
+ self.push_root(lp1)
+ #
+ self.switch(0)
+ stm_major_collect()
+ #
+ self.switch(1)
+ lp1 = self.pop_root()
+ assert stm_get_weakref(lp1) == lp0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit