def test_ffi_buffer_ptr_size(self):
ffi = FFI(backend=self.Backend())
a = ffi.new("short *", 0x4243)
try:
b = ffi.buffer(a, 1)
except NotImplementedError as e:
py.test.skip(str(e))
content = b[:]
assert len(content) == 1
if sys.byteorder == 'little':
assert content == b'\x43'
b[0] = b'\x62'
assert a[0] == 0x4262
else:
assert content == b'\x42'
b[0] = b'\x63'
assert a[0] == 0x6343
评论列表
文章目录