[pypy-svn] r24188 - pypy/dist/pypy/objspace

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Mar 9 18:35:42 CET 2006


Author: cfbolz
Date: Thu Mar  9 18:35:41 2006
New Revision: 24188

Modified:
   pypy/dist/pypy/objspace/logic.py
Log:
(pedronis, cfbolz):

make it possible to return values from your microthread


Modified: pypy/dist/pypy/objspace/logic.py
==============================================================================
--- pypy/dist/pypy/objspace/logic.py	(original)
+++ pypy/dist/pypy/objspace/logic.py	Thu Mar  9 18:35:41 2006
@@ -14,8 +14,9 @@
     main_greenlet = greenlet.getcurrent()
 
     def uthread(space, w_callable, __args__):
+        w_Result = W_Var()
         def run():
-            space.call_args(w_callable, __args__)
+            space.eq(w_Result, space.call_args(w_callable, __args__))
         gr = greenlet(run)
         current = greenlet.getcurrent()
         runnable_uthreads[current] = True
@@ -25,7 +26,7 @@
             if next_greenlet and next_greenlet is not current:
                 runnable_uthreads[current] = True
                 next_greenlet.switch()
-        return space.w_None
+        return w_Result
     app_uthread = gateway.interp2app(uthread, unwrap_spec=[baseobjspace.ObjSpace,
                                                            baseobjspace.W_Root,
                                                            argument.Arguments])



More information about the Pypy-commit mailing list