[pypy-svn] pypy fast-forward: Don't need to store the arguments shapes

amauryfa commits-noreply at bitbucket.org
Fri Jan 14 18:24:59 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40690:e4977b76e2e6
Date: 2011-01-14 16:41 +0100
http://bitbucket.org/pypy/pypy/changeset/e4977b76e2e6/

Log:	Don't need to store the arguments shapes

diff --git a/pypy/module/_rawffi/callback.py b/pypy/module/_rawffi/callback.py
--- a/pypy/module/_rawffi/callback.py
+++ b/pypy/module/_rawffi/callback.py
@@ -26,13 +26,13 @@
     userdata = rffi.cast(USERDATA_P, ll_userdata)
     callback_ptr = global_counter.CallbackPtr_by_number[userdata.addarg]
     w_callable = callback_ptr.w_callable
-    args = callback_ptr.args
+    nargs = callback_ptr.nargs
     space = callback_ptr.space
     try:
         # XXX The app-level callback gets the arguments as a list of integers.
         #     Irregular interface here.  Shows something, I say.
         w_args = space.newlist([space.wrap(rffi.cast(rffi.ULONG, ll_args[i]))
-                                for i in range(len(args))])
+                                for i in range(nargs)])
         w_res = space.call(w_callable, w_args)
         if callback_ptr.result is not None: # don't return void
             unwrap_value(space, push_elem, ll_res, 0,
@@ -62,9 +62,10 @@
                  flags=FUNCFLAG_CDECL):
         self.space = space
         self.w_callable = w_callable
-        self.args = [space.str_w(w_arg) for w_arg in space.unpackiterable(
+        args = [space.str_w(w_arg) for w_arg in space.unpackiterable(
             w_args)]
-        ffiargs = [letter2tp(space, x).get_basic_ffi_type() for x in self.args]
+        self.nargs = len(args)
+        ffiargs = [letter2tp(space, x).get_basic_ffi_type() for x in args]
         if not space.is_w(w_result, space.w_None):
             self.result = space.str_w(w_result)
             ffiresult = letter2tp(space, self.result).get_basic_ffi_type()


More information about the Pypy-commit mailing list