[pypy-commit] pypy reflex-support: Fix compiler warning and conform to the new treatment of single floats.

wlav noreply at buildbot.pypy.org
Thu Aug 4 03:07:26 CEST 2011


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r46263:c8a8e5201532
Date: 2011-08-03 12:39 -0700
http://bitbucket.org/pypy/pypy/changeset/c8a8e5201532/

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

diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -346,8 +346,10 @@
         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)
diff --git a/pypy/module/cppyy/executor.py b/pypy/module/cppyy/executor.py
--- a/pypy/module/cppyy/executor.py
+++ b/pypy/module/cppyy/executor.py
@@ -177,11 +177,11 @@
 
     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
diff --git a/pypy/module/cppyy/interp_cppyy.py b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -524,6 +524,7 @@
     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)
diff --git a/pypy/module/cppyy/src/reflexcwrapper.cxx b/pypy/module/cppyy/src/reflexcwrapper.cxx
--- a/pypy/module/cppyy/src/reflexcwrapper.cxx
+++ b/pypy/module/cppyy/src/reflexcwrapper.cxx
@@ -203,7 +203,7 @@
 /* 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;
 }


More information about the pypy-commit mailing list