[pypy-svn] r28752 - pypy/dist/pypy/module/_stackless
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Jun 13 20:20:53 CEST 2006
Author: cfbolz
Date: Tue Jun 13 20:20:52 2006
New Revision: 28752
Added:
pypy/dist/pypy/module/_stackless/app_greenlet.py
Modified:
pypy/dist/pypy/module/_stackless/__init__.py
pypy/dist/pypy/module/_stackless/interp_greenlet.py
Log:
exposing of GreenletExit + some stupid typos
Modified: pypy/dist/pypy/module/_stackless/__init__.py
==============================================================================
--- pypy/dist/pypy/module/_stackless/__init__.py (original)
+++ pypy/dist/pypy/module/_stackless/__init__.py Tue Jun 13 20:20:52 2006
@@ -7,6 +7,8 @@
"""
appleveldefs = {
+ 'GreenletExit' : 'app_greenlet.GreenletExit',
+ 'GreenletError' : 'app_greenlet.GreenletError',
}
interpleveldefs = {
Added: pypy/dist/pypy/module/_stackless/app_greenlet.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/module/_stackless/app_greenlet.py Tue Jun 13 20:20:52 2006
@@ -0,0 +1,5 @@
+class GreenletExit(Exception):
+ pass
+
+class GreenletError(Exception):
+ pass
Modified: pypy/dist/pypy/module/_stackless/interp_greenlet.py
==============================================================================
--- pypy/dist/pypy/module/_stackless/interp_greenlet.py (original)
+++ pypy/dist/pypy/module/_stackless/interp_greenlet.py Tue Jun 13 20:20:52 2006
@@ -93,8 +93,8 @@
#print "switch", __args__, id(self)
if __args__.num_kwds():
raise OperationError(
- space.w_TypeError,
- space.wrap("switch() takes not keyword arguments"))
+ self.space.w_TypeError,
+ self.space.wrap("switch() takes not keyword arguments"))
self.has_ever_run = True
self.costate.__args__ = __args__
self.switch()
@@ -113,7 +113,7 @@
def w_throw(self, w_exception):
self.costate.operr = OperationError(w_exception, self.space.wrap(""))
- self.w_switch(Arguments([]))
+ self.w_switch(Arguments(self.space, []))
def _userdel(self):
self.space.userdel(self)
@@ -145,10 +145,21 @@
except IndexError:
return space.w_None
+def get(space, name):
+ w_module = space.getbuiltinmodule('_stackless')
+ return space.getattr(w_module, space.wrap(name))
+
def post_install(module):
makeStaticMethod(module, 'greenlet', 'getcurrent')
space = module.space
AppGreenlet._get_state(space).post_install()
+ w_module = space.getbuiltinmodule('_stackless')
+ space.appexec([w_module, get(space, "GreenletExit"),
+ get(space, "GreenletError")], """
+ (mod, exit, error):
+ mod.greenlet.GreenletExit = exit
+ mod.greenlet.error = error
+ """)
AppGreenlet.typedef = TypeDef("greenlet",
__new__ = interp2app(AppGreenlet.descr_method__new__.im_func),
More information about the Pypy-commit
mailing list