Author: Armin Rigo <ar...@tunes.org>
Branch: stmgc-c4
Changeset: r66845:bd5b23f0f700
Date: 2013-09-07 20:10 +0200
http://bitbucket.org/pypy/pypy/changeset/bd5b23f0f700/

Log:    Yes, it was a fix. Here's the test.

diff --git a/rpython/translator/stm/test/test_writebarrier.py 
b/rpython/translator/stm/test/test_writebarrier.py
--- a/rpython/translator/stm/test/test_writebarrier.py
+++ b/rpython/translator/stm/test/test_writebarrier.py
@@ -28,6 +28,24 @@
         assert len(self.writemode) == 0
         assert self.barriers == ['I2R']
 
+    def test_simple_read_2(self):
+        X = lltype.GcStruct('X', ('foo', lltype.Signed))
+        x2 = lltype.malloc(X, immortal=True)
+        x2.foo = 81
+        null = lltype.nullptr(X)
+
+        def f1(n):
+            if n < 1:
+                p = null
+            else:
+                p = x2
+            return p.foo
+
+        res = self.interpret(f1, [4])
+        assert res == 81
+        assert len(self.writemode) == 0
+        assert self.barriers == ['I2R']
+
     def test_simple_write(self):
         X = lltype.GcStruct('X', ('foo', lltype.Signed))
         x1 = lltype.malloc(X, immortal=True)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to