[pypy-commit] pypy remove-remaining-smm: Fix translation.

Manuel Jacob noreply at buildbot.pypy.org
Thu Feb 27 01:36:23 CET 2014


Author: Manuel Jacob
Branch: remove-remaining-smm
Changeset: r69472:d5a11afb2206
Date: 2014-02-27 01:35 +0100
http://bitbucket.org/pypy/pypy/changeset/d5a11afb2206/

Log:	Fix translation.

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -593,8 +593,16 @@
                     self.__class__ = BuiltinCodePassThroughArguments1
                     self.func__args__ = func
                 elif unwrap_spec == [self_type, ObjSpace, Arguments]:
-                    self.__class__ = BuiltinCodePassThroughArgumentsMethod
-                    self.func__args__ = func
+                    self.__class__ = BuiltinCodePassThroughArguments1
+                    miniglobals = {'func': func, 'self_type': self_type}
+                    d = {}
+                    source = """if 1:
+                        def _call(space, w_obj, args):
+                            self = space.descr_self_interp_w(self_type, w_obj)
+                            return func(self, space, args)
+                        \n"""
+                    exec compile2(source) in miniglobals, d
+                    self.func__args__ = d['_call']
             else:
                 self.__class__ = globals()['BuiltinCode%d' % arity]
                 setattr(self, 'fastfunc_%d' % arity, fastfunc)
@@ -703,27 +711,6 @@
         return w_result
 
 
-class BuiltinCodePassThroughArgumentsMethod(BuiltinCodePassThroughArguments1):
-    # almost the same as BuiltinCodePassThroughArguments1 but passes w_obj
-    # first for the case when self.func__args__ is a method
-
-    def funcrun_obj(self, func, w_obj, args):
-        space = func.space
-        try:
-            w_result = self.func__args__(w_obj, space, args)
-        except DescrMismatch:
-            return args.firstarg().descr_call_mismatch(space,
-                                                  self.descrmismatch_op,
-                                                  self.descr_reqcls,
-                                                  args.prepend(w_obj))
-        except Exception, e:
-            self.handle_exception(space, e)
-            w_result = None
-        if w_result is None:
-            w_result = space.w_None
-        return w_result
-
-
 class BuiltinCode0(BuiltinCode):
     _immutable_ = True
     fast_natural_arity = 0


More information about the pypy-commit mailing list