[pypy-commit] cffi default: Test and fix.

arigo noreply at buildbot.pypy.org
Thu Jul 26 21:53:59 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r692:bcb1f88942a8
Date: 2012-07-26 21:53 +0200
http://bitbucket.org/cffi/cffi/changeset/bcb1f88942a8/

Log:	Test and fix.

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1217,7 +1217,7 @@
         return _my_PyUnicode_FromWideChar((wchar_t *)cd->c_data, length);
     }
     else
-        return cdata_repr(cd);
+        return Py_TYPE(cd)->tp_repr((PyObject *)cd);
 }
 #endif
 
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -302,6 +302,14 @@
     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)


More information about the pypy-commit mailing list