[pypy-commit] pypy cling-support: from Aditi: more typecode fixes

wlav pypy.commits at gmail.com
Wed Jul 6 15:56:34 EDT 2016


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: cling-support
Changeset: r85592:bbbf4b479fc5
Date: 2016-07-06 12:53 -0700
http://bitbucket.org/pypy/pypy/changeset/bbbf4b479fc5/

Log:	from Aditi: more typecode fixes

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
@@ -284,6 +284,8 @@
     def convert_argument(self, space, w_obj, address, call_local):
         x = rffi.cast(rffi.LONGP, address)
         x[0] = self._unwrap_object(space, w_obj)
+        ba = rffi.cast(rffi.CCHARP, address)
+        ba[capi.c_function_arg_typeoffset(space)] = 'b'
 
     def convert_argument_libffi(self, space, w_obj, address, call_local):
         x = rffi.cast(rffi.LONGP, address)
@@ -307,6 +309,8 @@
     def convert_argument(self, space, w_obj, address, call_local):
         x = rffi.cast(rffi.CCHARP, address)
         x[0] = self._unwrap_object(space, w_obj)
+        ba = rffi.cast(rffi.CCHARP, address)
+        ba[capi.c_function_arg_typeoffset(space)] = 'b'
 
     def convert_argument_libffi(self, space, w_obj, address, call_local):
         x = rffi.cast(self.c_ptrtype, address)
diff --git a/pypy/module/cppyy/src/clingcwrapper.cxx b/pypy/module/cppyy/src/clingcwrapper.cxx
--- a/pypy/module/cppyy/src/clingcwrapper.cxx
+++ b/pypy/module/cppyy/src/clingcwrapper.cxx
@@ -368,7 +368,7 @@
       case 'K':          /* unsigned long long */
          vargs[i] = (void*)&args[i].fValue.fULongLong;
          break;
-      case 'f':          /* double */
+      case 'f':          /* float */
          vargs[i] = (void*)&args[i].fValue.fFloat;
          break;
       case 'd':          /* double */
diff --git a/pypy/module/cppyy/test/test_datatypes.py b/pypy/module/cppyy/test/test_datatypes.py
--- a/pypy/module/cppyy/test/test_datatypes.py
+++ b/pypy/module/cppyy/test/test_datatypes.py
@@ -124,8 +124,7 @@
         assert isinstance(c, cppyy_test_data)
 
         # boolean types through functions
-        c.set_bool(True);
-        assert c.get_bool() == True
+        c.set_bool(True);  assert c.get_bool() == True
         c.set_bool(0);     assert c.get_bool() == False
 
         # boolean types through data members


More information about the pypy-commit mailing list