Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r90195:0f157eedb3b2
Date: 2017-02-19 12:36 +0100
http://bitbucket.org/pypy/pypy/changeset/0f157eedb3b2/

Log:    fix merge issues: before the merge, the code (not the tests) was
        identical in pypy2 and pypy3, so just make it identical again

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
@@ -771,6 +771,7 @@
     for c_type, names, c_tc in type_info:
         class BasicConverter(ffitypes.typeid(c_type), IntTypeConverterMixin, 
TypeConverter):
             _immutable_ = True
+            typecode = c_tc
             def __init__(self, space, default):
                 self.default = rffi.cast(self.c_type, capi.c_strtoll(space, 
default))
         class ConstRefConverter(ConstRefNumericTypeConverterMixin, 
BasicConverter):
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
@@ -2,6 +2,7 @@
 
 from rpython.rtyper.lltypesystem import rffi
 from rpython.rlib.rarithmetic import r_singlefloat, r_longfloat
+from rpython.rlib.rbigint import rbigint
 
 from pypy.module._cffi_backend import newtype
 
@@ -41,7 +42,6 @@
         self.c_size_t    = nt.new_primitive_type(space, 'size_t')
         self.c_ptrdiff_t = nt.new_primitive_type(space, 'ptrdiff_t')
 
-
 class BoolTypeMixin(object):
     _mixin_     = True
     _immutable_fields_ = ['c_type', 'c_ptrtype']
@@ -49,6 +49,9 @@
     c_type      = rffi.UCHAR
     c_ptrtype   = rffi.UCHARP
 
+    def _wrap_object(self, space, obj):
+        return space.newbool(bool(ord(rffi.cast(rffi.CHAR, obj))))
+
     def _unwrap_object(self, space, w_obj):
         arg = space.c_int_w(w_obj)
         if arg != False and arg != True:
@@ -56,9 +59,6 @@
                         "boolean value should be bool, or integer 1 or 0")
         return arg
 
-    def _wrap_object(self, space, obj):
-        return space.newbool(bool(ord(rffi.cast(rffi.CHAR, obj))))
-
     def cffi_type(self, space):
         state = space.fromcache(State)
         return state.c_bool
@@ -93,44 +93,44 @@
         state = space.fromcache(State)
         return state.c_char
 
-class ShortTypeMixin(object):
+class BaseIntTypeMixin(object):
+    _mixin_     = True
+
+    def _wrap_object(self, space, obj):
+        return space.newint(rffi.cast(rffi.INT, obj))
+
+    def _unwrap_object(self, space, w_obj):
+        return rffi.cast(self.c_type, space.c_int_w(w_obj))
+
+class ShortTypeMixin(BaseIntTypeMixin):
     _mixin_     = True
     _immutable_fields_ = ['c_type', 'c_ptrtype']
 
     c_type      = rffi.SHORT
     c_ptrtype   = rffi.SHORTP
 
-    def _unwrap_object(self, space, w_obj):
-        return rffi.cast(rffi.SHORT, space.int_w(w_obj))
-
+class UShortTypeMixin(BaseIntTypeMixin):
     def cffi_type(self, space):
         state = space.fromcache(State)
         return state.c_short
 
-class UShortTypeMixin(object):
     _mixin_     = True
     _immutable_fields_ = ['c_type', 'c_ptrtype']
 
     c_type      = rffi.USHORT
     c_ptrtype   = rffi.USHORTP
 
-    def _unwrap_object(self, space, w_obj):
-        return rffi.cast(self.c_type, space.int_w(w_obj))
-
+class IntTypeMixin(BaseIntTypeMixin):
     def cffi_type(self, space):
         state = space.fromcache(State)
         return state.c_ushort
 
-class IntTypeMixin(object):
     _mixin_     = True
     _immutable_fields_ = ['c_type', 'c_ptrtype']
 
     c_type      = rffi.INT
     c_ptrtype   = rffi.INTP
 
-    def _unwrap_object(self, space, w_obj):
-        return rffi.cast(self.c_type, space.c_int_w(w_obj))
-
     def cffi_type(self, space):
         state = space.fromcache(State)
         return state.c_int
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to