Mark Dickinson <dicki...@gmail.com> added the comment: Thanks. It looks like that <<= report has uncovered a bug in the way that ctypes lays out bitfields: in the following, BITS.M should (I believe) look like: <Field type=c_short, ofs=4:0, bits=1>. Instead, ctypes is trying to store a bitfield starting at bit position 17 of a short, which doesn't make much sense.
iwasawa:cpython mdickinson$ ./python.exe Python 3.3.0a4+ (default:2035c5ad4239+, Jun 21 2012, 08:30:36) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import Structure, c_int, c_short >>> class BITS(Structure): ... _fields_ = [("A", c_int, 17), ("M", c_short, 1)] ... >>> BITS.M <Field type=c_short, ofs=2:17, bits=1> ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9530> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com