[pypy-svn] rev 1017 - pypy/trunk/src/pypy/objspace
mwh at codespeak.net
mwh at codespeak.net
Mon Jun 23 19:19:24 CEST 2003
Author: mwh
Date: Mon Jun 23 19:19:23 2003
New Revision: 1017
Modified:
pypy/trunk/src/pypy/objspace/trivial.py
Log:
color me a bit confused.
i was doing some work to make iterators work better in the standard
object space, and the tests started working much earlier than i expected.
if you run into weird behaviour with the trivial object space, come and
talk to me!
Modified: pypy/trunk/src/pypy/objspace/trivial.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/trivial.py (original)
+++ pypy/trunk/src/pypy/objspace/trivial.py Mon Jun 23 19:19:23 2003
@@ -32,6 +32,26 @@
def __iter__(self):
return self
+class numeth(object):
+ def __init__(self, space, func, inst, cls):
+ self.space = space
+ self.func = func
+ self.inst = inst
+ self.cls = cls
+ def _call_(self, *args, **kws):
+ if self.inst is None and self.cls is not type(None):
+ pass
+ else:
+ args = (self.inst,) + args
+ return self.func(*args, **kws)
+ def __call__(self, *args, **kws):
+ try:
+ return self._call_(*args, **kws)
+ except OperationError, oe:
+ raise eval(oe.w_type.__name__)
+ except:
+ raise
+
class nufun(object):
def __init__(self, space, code, globals, defaultarguments, closure):
self.space = space
@@ -54,8 +74,7 @@
def __call__(self, *args, **kwds):
return self.do_call(*args, **kwds)
def __get__(self, ob, cls=None):
- import new
- return new.instancemethod(self, ob, cls)
+ return numeth(self.space, self, ob, cls)
class TrivialObjSpace(ObjSpace):
More information about the Pypy-commit
mailing list