[pypy-svn] r28200 - pypy/dist/pypy/translator/stackless/test

mwh at codespeak.net mwh at codespeak.net
Sat Jun 3 20:25:49 CEST 2006


Author: mwh
Date: Sat Jun  3 20:25:48 2006
New Revision: 28200

Modified:
   pypy/dist/pypy/translator/stackless/test/test_resume_point.py
Log:
(mwh, pedronis)
a test about resuming and exceptions.  it passes.


Modified: pypy/dist/pypy/translator/stackless/test/test_resume_point.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/test/test_resume_point.py	(original)
+++ pypy/dist/pypy/translator/stackless/test/test_resume_point.py	Sat Jun  3 20:25:48 2006
@@ -162,3 +162,20 @@
     res = llinterp_stackless_function(example)
     assert res == 204
 
+def test_resume_and_raise():
+    def g(x):
+        rstack.resume_point("rp0", x)
+        if x == 0:
+            raise KeyError
+        return x + 1
+    def example():
+        v1 = g(one())
+        s = rstack.resume_state_create(None, "rp0", one()-1)
+        try:
+            v2 = rstack.resume_state_invoke(int, s)
+        except KeyError:
+            v2 = 42
+        return v1*100 + v2
+    res = llinterp_stackless_function(example)
+    assert res == 242
+    



More information about the Pypy-commit mailing list