Commits

Armin Rigo committed d7a65a9

Last remaining fixes. Now test_c passes again

  • Participants
  • Parent commits bdc5a8e
  • Branches ffi-backend

Comments (0)

Files changed (3)

pypy/module/_cffi_backend/ctypefunc.py

             elif size == 4: return _settype(ctype, clibffi.ffi_type_sint32)
             elif size == 8: return _settype(ctype, clibffi.ffi_type_sint64)
 
-        elif (isinstance(ctype, ctypeprim.W_CTypePrimitiveCharOrWChar) or
+        elif (isinstance(ctype, ctypeprim.W_CTypePrimitiveCharOrUniChar) or
               isinstance(ctype, ctypeprim.W_CTypePrimitiveUnsigned)):
             if   size == 1: return _settype(ctype, clibffi.ffi_type_uint8)
             elif size == 2: return _settype(ctype, clibffi.ffi_type_uint16)

pypy/module/_cffi_backend/ctypeobj.py

         return cdataobj.repr()
 
     def unicode(self, cdataobj):
-        XXX
+        return cdataobj.repr()
 
     def add(self, cdata, i):
         space = self.space

pypy/module/_cffi_backend/test/_backend_test_c.py

     x = newp(BArray, None)
     assert str(x) == repr(x)
 
+def test_default_unicode():
+    BInt = new_primitive_type("int")
+    x = cast(BInt, 42)
+    assert unicode(x) == unicode(repr(x))
+    BArray = new_array_type(new_pointer_type(BInt), 10)
+    x = newp(BArray, None)
+    assert unicode(x) == unicode(repr(x))
+
 def test_cast_from_cdataint():
     BInt = new_primitive_type("int")
     x = cast(BInt, 0)