Commits

wlav committed c8a8e52

Fix compiler warning and conform to the new treatment of single floats.

Comments (0)

Files changed (4)

pypy/module/cppyy/converter.py

         x[0] = self._unwrap_object(space, w_obj)
 
     def convert_argument_libffi(self, space, w_obj, argchain):
-        # it's required to sent an rffi.DOUBLE not r_singlefloat
-        argchain.arg_singlefloat(space.float_w(w_obj))
+        from pypy.rlib.rarithmetic import r_singlefloat
+        fval = space.float_w(w_obj)
+        sfval = r_singlefloat(fval)
+        argchain.arg(sfval)
 
     def from_memory(self, space, w_obj, w_type, offset):
         address = self._get_raw_address(space, w_obj, offset)

pypy/module/cppyy/executor.py

 
     def execute(self, space, w_returntype, func, cppthis, num_args, args):
         result = capi.c_call_f(func.cpptype.handle, func.method_index, cppthis, num_args, args)
-        return space.wrap(result)
+        return space.wrap(float(result))
 
     def execute_libffi(self, space, w_returntype, libffifunc, argchain):
         result = libffifunc.call(argchain, rffi.FLOAT)
-        return space.wrap(result)
+        return space.wrap(float(result))
 
 class DoubleExecutor(FunctionExecutor):
     _immutable_ = True

pypy/module/cppyy/interp_cppyy.py

     cppclass = interp_attrproperty('cppclass', W_CPPInstance),
     destruct = interp2app(W_CPPInstance.destruct, unwrap_spec=['self']),
 )
+W_CPPInstance.typedef.acceptable_as_base_class = True
 
 def new_instance(space, w_type, cpptype, rawptr, owns):
     w_instance = space.allocate_instance(W_CPPInstance, w_type)

pypy/module/cppyy/src/reflexcwrapper.cxx

 /* handling of function argument buffer ----------------------------------- */
 void* cppyy_allocate_function_args(size_t nargs) {
     CPPYY_G__value* args = (CPPYY_G__value*)malloc(nargs*sizeof(CPPYY_G__value));
-    for (int i = 0; i < nargs; ++i)
+    for (size_t i = 0; i < nargs; ++i)
         args[i].type = 'l';
     return (void*)args;
 }