[pypy-commit] pypy ffi-backend: Last remaining fixes. Now test_c passes again
arigo
noreply at buildbot.pypy.org
Thu Jul 26 21:57:25 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r56484:d7a65a95351a
Date: 2012-07-26 21:55 +0200
http://bitbucket.org/pypy/pypy/changeset/d7a65a95351a/
Log: Last remaining fixes. Now test_c passes again
diff --git a/pypy/module/_cffi_backend/ctypefunc.py b/pypy/module/_cffi_backend/ctypefunc.py
--- a/pypy/module/_cffi_backend/ctypefunc.py
+++ b/pypy/module/_cffi_backend/ctypefunc.py
@@ -306,7 +306,7 @@
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)
diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py
--- a/pypy/module/_cffi_backend/ctypeobj.py
+++ b/pypy/module/_cffi_backend/ctypeobj.py
@@ -87,7 +87,7 @@
return cdataobj.repr()
def unicode(self, cdataobj):
- XXX
+ return cdataobj.repr()
def add(self, cdata, i):
space = self.space
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -292,6 +292,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