[pypy-commit] pypy stm-gc: A failing test.

arigo noreply at buildbot.pypy.org
Sun Apr 22 12:17:23 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54612:a9866b7ee8ed
Date: 2012-04-21 16:09 +0200
http://bitbucket.org/pypy/pypy/changeset/a9866b7ee8ed/

Log:	A failing test.

diff --git a/pypy/translator/stm/test/test_ztranslated.py b/pypy/translator/stm/test/test_ztranslated.py
--- a/pypy/translator/stm/test/test_ztranslated.py
+++ b/pypy/translator/stm/test/test_ztranslated.py
@@ -47,3 +47,30 @@
         t, cbuilder = self.compile(entry_point, backendopt=True)
         data = cbuilder.cmdexec('a b c d')
         assert '< 5 1000 >' in data, "got: %r" % (data,)
+
+    def test_bug2(self):
+        from pypy.rlib import rstm
+        #
+        class X2:
+            pass
+        prebuilt2 = [X2(), X2()]
+        #
+        def bug2(count):
+            x = prebuilt2[count]
+            x.foobar = 2                    # 'x' becomes a local
+            #
+            rstm.enter_transactional_mode() # 'x' becomes the global again
+            rstm.leave_transactional_mode()
+            #
+            y = prebuilt2[count]            # same prebuilt obj
+            y.foobar += 10                  # 'y' becomes a local
+            return x.foobar                 # read from the global, thinking
+        bug2._dont_inline_ = True           #    that it is still a local
+        def entry_point(argv):
+            print bug2(0)
+            print bug2(1)
+            return 0
+        #
+        t, cbuilder = self.compile(entry_point, backendopt=True)
+        data = cbuilder.cmdexec('')
+        assert '12\n12\n' in data, "got: %r" % (data,)


More information about the pypy-commit mailing list