Author: Wim Lavrijsen <wlavrij...@lbl.gov>
Branch: cling-support
Changeset: r89049:e04b47226aa3
Date: 2016-12-13 10:52 -0800
http://bitbucket.org/pypy/pypy/changeset/e04b47226aa3/

Log:    downgrade long double to double as annotator support is not there

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
@@ -386,7 +386,9 @@
             fval = float(rfloat.rstring_to_float(default))
         else:
             fval = float(0.)
-        self.default = r_longfloat(fval)
+        # see ffitypes.LongDoubleTypeMixin: long double not really
+        # supported in rffi
+        self.default = fval #r_longfloat(fval)
 
     def from_memory(self, space, w_obj, w_pycppclass, offset):
         address = self._get_raw_address(space, w_obj, offset)
diff --git a/pypy/module/cppyy/ffitypes.py b/pypy/module/cppyy/ffitypes.py
--- a/pypy/module/cppyy/ffitypes.py
+++ b/pypy/module/cppyy/ffitypes.py
@@ -1,7 +1,7 @@
 from pypy.interpreter.error import oefmt
 
 from rpython.rtyper.lltypesystem import rffi
-from rpython.rlib.rarithmetic import r_singlefloat
+from rpython.rlib.rarithmetic import r_singlefloat, r_longfloat
 
 from pypy.module._cffi_backend import newtype
 
@@ -239,21 +239,25 @@
     _mixin_     = True
     _immutable_fields_ = ['c_type', 'c_ptrtype', 'typecode']
 
-    c_type      = rffi.LONGDOUBLE
-    c_ptrtype   = rffi.LONGDOUBLEP
+    # long double is not really supported, so work with normal
+    # double instead; doing it here keeps this localized
+    c_type      = rffi.DOUBLE  #rffi.LONGDOUBLE
+    c_ptrtype   = rffi.DOUBLEP #rffi.LONGDOUBLEP
     typecode    = 'g'
 
     def _unwrap_object(self, space, w_obj):
-        return space.float_w(w_obj)
+        #return r_longfloat(space.float_w(w_obj))
+        return float(space.float_w(w_obj))
 
     def _wrap_object(self, space, obj):
-        # long double not really supported, so force a cast to double
+        # return space.wrap(obj)
         dbl = rffi.cast(rffi.DOUBLE, obj)
         return space.wrap(float(dbl))
 
     def cffi_type(self, space):
         state = space.fromcache(State)
-        return state.c_ldouble
+        #return state.c_ldouble
+        return state.c_double
 
 def typeid(c_type):
     "NOT_RPYTHON"
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to