diff options
author | Armin Rigo <arigo@tunes.org> | 2013-02-07 19:50:44 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2013-02-07 19:50:44 +0100 |
commit | c0fc1876fea0d2b86b3d067fc7ee4c7f332c8e93 (patch) | |
tree | 1a4fe0cb5e242330377dca2fb04d5b7bc8e51d77 | |
parent | b82863c1d185c485a39349af2a1c41633286ea80 (diff) | |
download | cffi-c0fc1876fea0d2b86b3d067fc7ee4c7f332c8e93.tar.gz |
Python 3 compat
-rw-r--r-- | c/test_c.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/c/test_c.py b/c/test_c.py index 083736f..2e58e66 100644 --- a/c/test_c.py +++ b/c/test_c.py @@ -20,6 +20,7 @@ if sys.version_info < (3,): 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 @@ else: 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 @@ def test_buffer_keepalive(): 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) |