[pypy-svn] r30475 - pypy/dist/pypy/module/_stackless
arigo at codespeak.net
arigo at codespeak.net
Mon Jul 24 19:59:58 CEST 2006
Author: arigo
Date: Mon Jul 24 19:59:56 2006
New Revision: 30475
Modified:
pypy/dist/pypy/module/_stackless/interp_coroutine.py
Log:
So far, on top of pypy-c, accessing 'py.magic.greenlet' raises ValueError
instead of ImportError.
Modified: pypy/dist/pypy/module/_stackless/interp_coroutine.py
==============================================================================
--- pypy/dist/pypy/module/_stackless/interp_coroutine.py (original)
+++ pypy/dist/pypy/module/_stackless/interp_coroutine.py Mon Jul 24 19:59:56 2006
@@ -36,27 +36,26 @@
try:
from py.magic import greenlet
#main_greenlet = greenlet.getcurrent()
+except (ImportError, ValueError):
+ def greenlet(*args, **kwargs):
+ raise NotImplementedError("need either greenlets or a translated version of pypy")
- class FrameChain(object):
+class FrameChain(object):
- def __init__(self, thunk=None):
- if thunk:
- self.greenlet = greenlet(thunk)
- else:
- self.greenlet = greenlet.getcurrent()
-
- def switch(self):
- last = FrameChain()
- return self.greenlet.switch(last)
-
- def shutdown(self):
- current = FrameChain()
- target = current.greenlet.parent
- target.switch(None)
+ def __init__(self, thunk=None):
+ if thunk:
+ self.greenlet = greenlet(thunk)
+ else:
+ self.greenlet = greenlet.getcurrent()
-except ImportError:
- def greenlet(*args, **kwargs):
- raise NotImplementedError("need either greenlets or a translated version of pypy")
+ def switch(self):
+ last = FrameChain()
+ return self.greenlet.switch(last)
+
+ def shutdown(self):
+ current = FrameChain()
+ target = current.greenlet.parent
+ target.switch(None)
import sys, os
More information about the Pypy-commit
mailing list