[pypy-svn] r41999 - pypy/dist/pypy/lib

stephan at codespeak.net stephan at codespeak.net
Thu Apr 12 10:42:53 CEST 2007


Author: stephan
Date: Thu Apr 12 10:42:52 2007
New Revision: 41999

Modified:
   pypy/dist/pypy/lib/stackless.py
Log:
added a tasklet.run method

Modified: pypy/dist/pypy/lib/stackless.py
==============================================================================
--- pypy/dist/pypy/lib/stackless.py	(original)
+++ pypy/dist/pypy/lib/stackless.py	Thu Apr 12 10:42:52 2007
@@ -71,7 +71,7 @@
             """
             try:
                 return greenlet.switch(self._frame)
-            except TypeError: # self._frame is the main coroutine
+            except TypeError, exp: # self._frame is the main coroutine
                 return greenlet.switch(self._frame.something)
 
         def kill(self):
@@ -353,6 +353,12 @@
         _scheduler_append(self)
         return self
 
+    def run(self):
+        if _scheduler_contains(self):
+            return
+        else:
+            _scheduler_append(self)
+
     def __reduce__(self):
         one, two, three = coroutine.__reduce__(self)
         assert one is coroutine



More information about the Pypy-commit mailing list