Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r1123:ba9640dcaa31
Date: 2013-02-07 19:50 +0100
http://bitbucket.org/cffi/cffi/changeset/ba9640dcaa31/

Log:    Python 3 compat

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -20,6 +20,7 @@
             return eval('u'+repr(other).replace(r'\\u', r'\u')
                                        .replace(r'\\U', r'\U'))
     u = U()
+    str2bytes = str
 else:
     type_or_class = "class"
     long = int
@@ -30,6 +31,7 @@
     bytechr = lambda n: bytes([n])
     bitem2bchr = bytechr
     u = ""
+    str2bytes = lambda s: bytes(s, "ascii")
 
 def size_of_int():
     BInt = new_primitive_type("int")
@@ -2564,9 +2566,9 @@
     BCharArray = new_array_type(BCharP, None)
     buflist = []
     for i in range(20):
-        c = newp(BCharArray, b"hi there %d" % i)
+        c = newp(BCharArray, str2bytes("hi there %d" % i))
         buflist.append(buffer(c))
     import gc; gc.collect()
     for i in range(20):
         buf = buflist[i]
-        assert buf[:] == b"hi there %d\x00" % i
+        assert buf[:] == str2bytes("hi there %d\x00" % i)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to