[pypy-svn] r21333 - pypy/dist/pypy/translator/c/test

rxe at codespeak.net rxe at codespeak.net
Mon Dec 19 23:11:35 CET 2005


Author: rxe
Date: Mon Dec 19 23:11:34 2005
New Revision: 21333

Modified:
   pypy/dist/pypy/translator/c/test/test_coroutine.py
Log:
Hack to make test work - not sure it makes sense.

The idea is we return to binder when the coroutine ends iff the binder still
has a frame (IOW is alive).  If the binder is not available, fall back to main.



Modified: pypy/dist/pypy/translator/c/test/test_coroutine.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_coroutine.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_coroutine.py	Mon Dec 19 23:11:34 2005
@@ -88,10 +88,13 @@
         self.frame = self._bind(thunk)
 
     def _bind(self, thunk):
+        binder = costate.current
         costate.last.frame = yield_current_frame_to_caller()
         thunk.call()
-        costate.last, costate.current = costate.current, costate.main
-        frame, costate.main.frame = costate.main.frame, None
+        if binder.frame is None:
+            binder = costate.main
+        costate.last, costate.current = costate.current, binder
+        frame, binder.frame = binder.frame, None
         return frame
 
     def switch(self):
@@ -164,8 +167,6 @@
 
 def test_coroutine2():
 
-    py.test.skip("failing test")
-    
     class TBase:
         def call(self):
             pass



More information about the Pypy-commit mailing list