[pypy-svn] r32526 - in pypy/dist/pypy: interpreter objspace/cpy
pedronis at codespeak.net
pedronis at codespeak.net
Wed Sep 20 15:41:13 CEST 2006
Author: pedronis
Date: Wed Sep 20 15:40:56 2006
New Revision: 32526
Modified:
pypy/dist/pypy/interpreter/gateway.py
pypy/dist/pypy/objspace/cpy/function.py
Log:
cosmetic refactoring: all recipe now share the dispatch method name, also avoid the strange return modified argument pattern
Modified: pypy/dist/pypy/interpreter/gateway.py
==============================================================================
--- pypy/dist/pypy/interpreter/gateway.py (original)
+++ pypy/dist/pypy/interpreter/gateway.py Wed Sep 20 15:40:56 2006
@@ -47,11 +47,11 @@
def signature(self):
return self.argnames, self.varargname, self.kwargname
- def apply_unwrap_spec(self, unwrap_spec, recipe, new_sig):
+ def apply_unwrap_spec(self, unwrap_spec, recipe, dest_sig):
self._argiter = iter(self.argnames)
+ dispatch = recipe.dispatch
for el in unwrap_spec:
- recipe(el, self, new_sig)
- return new_sig
+ dispatch(el, self, dest_sig)
class UnwrapSpecRecipe:
@@ -399,8 +399,9 @@
def make_builtin_frame_factory(func, orig_sig, unwrap_spec):
"NOT_RPYTHON"
name = (getattr(func, '__module__', None) or '')+'_'+func.__name__
- emit_sig = orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpec_Emit().dispatch,
- BuiltinCodeSignature(name=name, unwrap_spec=unwrap_spec))
+ emit_sig = BuiltinCodeSignature(name=name, unwrap_spec=unwrap_spec)
+ orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpec_Emit(),
+ dest_sig = emit_sig)
return emit_sig.make_frame_factory(func)
class FastFuncNotSupported(Exception):
@@ -489,8 +490,9 @@
orig_sig = Signature(func, argnames, varargname, kwargname)
- app_sig = orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpec_Check().dispatch,
- Signature(func))
+ app_sig = Signature(func)
+ orig_sig.apply_unwrap_spec(unwrap_spec, UnwrapSpec_Check(),
+ dest_sig = app_sig)
self.sig = argnames, varargname, kwargname = app_sig.signature()
Modified: pypy/dist/pypy/objspace/cpy/function.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/function.py (original)
+++ pypy/dist/pypy/objspace/cpy/function.py Wed Sep 20 15:40:56 2006
@@ -98,6 +98,10 @@
factory = func.code.framefactory
bltin = factory.behavior
unwrap_spec = factory.unwrap_spec
+ from pypy.interpreter import pycode
+ argnames, varargname, kwargname = pycode.cpython_code_signature(
+ bltin.func_code)
+ orig_sig = Signature(bltin, argnames, varargname, kwargname)
tramp = TrampolineSignature()
tramp.miniglobals = {
@@ -107,15 +111,9 @@
'___OperationError': OperationError,
'___reraise': reraise,
}
-
- from pypy.interpreter import pycode
- argnames, varargname, kwargname = pycode.cpython_code_signature(
- bltin.func_code)
- orig_sig = Signature(bltin, argnames, varargname, kwargname)
-
orig_sig.apply_unwrap_spec(unwrap_spec,
- UnwrapSpec_Trampoline().dispatch,
- tramp)
+ UnwrapSpec_Trampoline(),
+ dest_sig = tramp)
sourcelines = ['def trampoline(%s):' % (', '.join(tramp.inputargs),)]
# this description is to aid viewing in graphviewer
More information about the Pypy-commit
mailing list