[pypy-svn] r28172 - pypy/dist/pypy/translator/stackless/test
mwh at codespeak.net
mwh at codespeak.net
Sat Jun 3 16:52:50 CEST 2006
Author: mwh
Date: Sat Jun 3 16:52:49 2006
New Revision: 28172
Modified:
pypy/dist/pypy/translator/stackless/test/test_resume_point.py
Log:
(mwh, pedronis)
A new test, which 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 16:52:49 2006
@@ -101,3 +101,25 @@
return 100*v1 + rstack.resume_state_invoke(int, s1)
res = llinterp_stackless_function(example, assert_unwind=False)
assert res == 811
+
+def test_return_instance():
+ class C:
+ pass
+ def g(x):
+ c = C()
+ c.x = x + 1
+ rstack.resume_point("rp1", c)
+ return c
+ def f(x, y):
+ r = g(x)
+ rstack.resume_point("rp2", y, returns=r)
+ return r.x + y
+ def example():
+ v1 = f(one(), 2*one())
+ s2 = rstack.resume_state_create(None, "rp2", 2*one())
+ c = C()
+ c.x = 4*one()
+ s1 = rstack.resume_state_create(s2, "rp1", c)
+ return v1*100 + rstack.resume_state_invoke(int, s1)
+ res = llinterp_stackless_function(example, assert_unwind=False)
+ assert res == 406
More information about the Pypy-commit
mailing list