[pypy-svn] r25297 - pypy/branch/explicit-exceptions/translator/c/test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Apr 4 16:13:46 CEST 2006


Author: cfbolz
Date: Tue Apr  4 16:13:44 2006
New Revision: 25297

Modified:
   pypy/branch/explicit-exceptions/translator/c/test/test_newgc.py
Log:
failing test due to missing keep_alives


Modified: pypy/branch/explicit-exceptions/translator/c/test/test_newgc.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/test/test_newgc.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/test/test_newgc.py	Tue Apr  4 16:13:44 2006
@@ -83,6 +83,30 @@
     fn = compile_func(g, [])
     assert fn() == 42
 
+def test_missing_keepalive_exception():
+    py.test.skip("failing due to missing keep_alives")
+    A = lltype.Array(lltype.Signed)
+    S = lltype.GcStruct("S", ('a', A))
+    def f(x):
+        if not x:
+            raise ValueError
+        return x + 1
+    def g(x):
+        s = lltype.malloc(S, x)
+        a = s.a
+        a[x - 1] = 42
+        i = x - 2
+        try:
+            i = f(i)
+        except ValueError:
+            i = x - 1
+        # need to allocate another instance, which will probably be in
+        # the same place as the previous one
+        s = lltype.malloc(S, x) 
+        return a[i]
+    fn = compile_func(g, [int])
+    assert fn(6) == 42
+
 def test_multiply_passed_var():
     S = lltype.GcStruct("S", ('x', lltype.Signed))
     def f(x):
@@ -313,3 +337,4 @@
         fn = self.getcompiled(f)
         res = fn()
         assert res == 43 + 1000000
+        



More information about the Pypy-commit mailing list