[issue12945] ctypes works incorrectly with _swappedbytes_ = 1
Pavel Boldin
report at bugs.python.org
Sun Sep 11 03:54:59 CEST 2011
Pavel Boldin <boldin.pavel at gmail.com> added the comment:
Yes. Thanks. But here is another error:
import ctypes
class X(ctypes.Structure):
_pack_ = 1
_fields_ = [
('a', ctypes.c_ubyte, 4),
('b', ctypes.c_ubyte, 4),
('c', ctypes.c_ushort, 4),
('d', ctypes.c_ushort, 12),
]
buf = '\x12\x34\x56\x78'
x = X.from_buffer_copy(buf)
print X.a
print X.b
print X.c
print X.d
print x.a == 2
print x.b == 1
print x.c == 4
print x.d == 0x563
Prints (python 2.7.1):
True
True
True
False
Can you reproduce this?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12945>
_______________________________________
More information about the Python-bugs-list
mailing list