[issue9989] ctypes bitfield problem
Ned Deily
report at bugs.python.org
Thu Sep 30 00:00:15 CEST 2010
Ned Deily <nad at acm.org> added the comment:
An endian issue? (i.e. on OS X, it works on ppc but not Intel)
A slightly more detailed test case:
$ more test_ctypes.py
import ctypes
class Blah2(ctypes.Structure):
_fields_ = [("x", ctypes.c_uint64, 64),
("y", ctypes.c_uint64)]
val = 0x0123456789ABCDEF
x = Blah2(val, val)
print(Blah2.x)
print(hex(x.x))
print(Blah2.y)
print(hex(x.y))
$ arch -i386 python2.7 test_ctypes.py
<Field type=c_ulonglong, ofs=0:0, bits=64>
0x0L
<Field type=c_ulonglong, ofs=8, size=8>
0x123456789abcdefL
$ arch -x86_64 python2.7 test_ctypes.py
<Field type=c_ulong, ofs=0:0, bits=64>
0x0L
<Field type=c_ulong, ofs=8, size=8>
0x123456789abcdefL
$ arch -ppc python2.7 test_ctypes.py
<Field type=c_ulonglong, ofs=0:0, bits=64>
0x123456789abcdefL
<Field type=c_ulonglong, ofs=8, size=8>
0x123456789abcdefL
----------
nosy: +ned.deily
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9989>
_______________________________________
More information about the Python-bugs-list
mailing list