[pypy-svn] r13001 - pypy/dist/pypy/interpreter
pedronis at codespeak.net
pedronis at codespeak.net
Thu Jun 2 13:59:17 CEST 2005
Author: pedronis
Date: Thu Jun 2 13:59:17 2005
New Revision: 13001
Modified:
pypy/dist/pypy/interpreter/gateway.py
Log:
don't use funky FuncBoxes anymore, just staticmethods
Modified: pypy/dist/pypy/interpreter/gateway.py
==============================================================================
--- pypy/dist/pypy/interpreter/gateway.py (original)
+++ pypy/dist/pypy/interpreter/gateway.py Thu Jun 2 13:59:17 2005
@@ -261,9 +261,6 @@
"""Subclasses with behavior specific for an unwrap spec are generated"""
raise TypeError, "abstract"
-class FuncBox(object):
- pass
-
class BuiltinCodeSignature(Signature):
"NOT_RPYTHON"
@@ -279,9 +276,9 @@
def _make_unwrap_frame_class(self, cache={}):
try:
key = tuple(self.unwrap_spec)
- frame_cls, box_cls, run_args = cache[key]
+ frame_cls, run_args = cache[key]
assert run_args == self.run_args,"unexpected: same spec, different run_args"
- return frame_cls, box_cls
+ return frame_cls
except KeyError:
parts = []
for el in self.unwrap_spec:
@@ -309,22 +306,19 @@
self.miniglobals['OperationError'] = OperationError
source = """if 1:
def _run_UWS_%s(self):
- return self.box.func(%s)
+ return self.behavior(%s)
\n""" % (label, ','.join(self.run_args))
exec compile2(source) in self.miniglobals, d
d['_run'] = d['_run_UWS_%s' % label]
del d['_run_UWS_%s' % label]
frame_cls = type("BuiltinFrame_UWS_%s" % label, (BuiltinFrame,), d)
- box_cls = type("FuncBox_UWS_%s" % label, (FuncBox,), {})
- cache[key] = frame_cls, box_cls, self.run_args
- return frame_cls, box_cls
+ cache[key] = frame_cls, self.run_args
+ return frame_cls
def make_frame_class(self, func, cache={}):
- frame_uw_cls, box_cls = self._make_unwrap_frame_class()
- box = box_cls()
- box.func = func
+ frame_uw_cls = self._make_unwrap_frame_class()
return type("BuiltinFrame_for_%s" % self.name,
- (frame_uw_cls,),{'box': box})
+ (frame_uw_cls,),{'behavior': staticmethod(func)})
def make_builtin_frame_class(func, orig_sig, unwrap_spec):
"NOT_RPYTHON"
@@ -403,7 +397,6 @@
def getdocstring(self):
return self.docstring
-
class interp2app(Wrappable):
"""Build a gateway that calls 'f' at interp-level."""
More information about the Pypy-commit
mailing list