[pypy-svn] r64162 - pypy/trunk/pypy/module/_rawffi

arigo at codespeak.net arigo at codespeak.net
Thu Apr 16 15:17:04 CEST 2009


Author: arigo
Date: Thu Apr 16 15:17:04 2009
New Revision: 64162

Modified:
   pypy/trunk/pypy/module/_rawffi/array.py
   pypy/trunk/pypy/module/_rawffi/callback.py
   pypy/trunk/pypy/module/_rawffi/interp_rawffi.py
   pypy/trunk/pypy/module/_rawffi/structure.py
Log:
Simplify unwrap_value()'s arguments.


Modified: pypy/trunk/pypy/module/_rawffi/array.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/array.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/array.py	Thu Apr 16 15:17:04 2009
@@ -50,7 +50,7 @@
             for num in range(iterlength):
                 w_item = items_w[num]
                 unwrap_value(space, push_elem, result.ll_buffer, num,
-                             self.itemtp, w_item)
+                             self.itemtp[0], w_item)
         return space.wrap(result)
 
     def descr_repr(self, space):
@@ -121,8 +121,8 @@
             raise segfault_exception(space, "setting element of freed array")
         if num >= self.length or num < 0:
             raise OperationError(space.w_IndexError, space.w_None)
-        unwrap_value(space, push_elem, self.ll_buffer, num, self.shape.itemtp,
-                     w_value)
+        unwrap_value(space, push_elem, self.ll_buffer, num,
+                     self.shape.itemtp[0], w_value)
 
     def descr_setitem(self, space, w_index, w_value):
         try:

Modified: pypy/trunk/pypy/module/_rawffi/callback.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/callback.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/callback.py	Thu Apr 16 15:17:04 2009
@@ -26,7 +26,6 @@
     userdata = rffi.cast(USERDATA_P, ll_userdata)
     callback_ptr = global_counter.CallbackPtr_by_number[userdata.addarg]
     w_callable = callback_ptr.w_callable
-    res = rffi.cast(rffi.VOIDPP, ll_res)
     argtypes = callback_ptr.args
     space = callback_ptr.space
     try:
@@ -35,7 +34,7 @@
         w_res = space.call(w_callable, w_args)
         if callback_ptr.result != 'O': # don't return void
             unwrap_value(space, push_elem, ll_res, 0,
-                         letter2tp(space, callback_ptr.result), w_res)
+                         callback_ptr.result, w_res)
     except OperationError, e:
         tbprint(space, space.wrap(e.application_traceback),
                 space.wrap(e.errorstr(space)))

Modified: pypy/trunk/pypy/module/_rawffi/interp_rawffi.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/interp_rawffi.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/interp_rawffi.py	Thu Apr 16 15:17:04 2009
@@ -300,8 +300,7 @@
         return rffi.cast(TP, space.bigint_w(w_arg).ulonglongmask())
 unwrap_truncate_int._annspecialcase_ = 'specialize:arg(0)'
 
-def unwrap_value(space, push_func, add_arg, argdesc, tp, w_arg):
-    letter, _, _ = tp
+def unwrap_value(space, push_func, add_arg, argdesc, letter, w_arg):
     w = space.wrap
     if letter == "d":
         push_func(add_arg, argdesc, space.float_w(w_arg))

Modified: pypy/trunk/pypy/module/_rawffi/structure.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/structure.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/structure.py	Thu Apr 16 15:17:04 2009
@@ -176,7 +176,7 @@
             raise segfault_exception(space, "accessing NULL pointer")
         i = self.shape.getindex(space, attr)
         _, tp = self.shape.fields[i]
-        unwrap_value(space, push_field, self, i, tp, w_value)
+        unwrap_value(space, push_field, self, i, tp[0], w_value)
     setattr.unwrap_spec = ['self', ObjSpace, str, W_Root]
 
     def descr_fieldaddress(self, space, attr):



More information about the Pypy-commit mailing list