Mark Dickinson <dicki...@gmail.com> added the comment: There are two separate issues here. The first is that the layout that ctypes chooses for a struct of bitfields fails basic sanity checks, like having each bitfield actually fit in the corresponding type. As a result, the C-level bitshifting code used to get bitfields ends up invoking undefined behaviour.
A secondary problem is that the ctypes layout doesn't match what the compiler does, at least for the system supplied gcc (4.2) on OS X 10.6. The attached patch fixes the first issue, but not the second. ---------- keywords: +patch title: Bug in ctypes bitfield layout? -> ctypes mixed-types bitfield layout nonsensical; doesn't match compiler. Added file: http://bugs.python.org/file26072/ctypes_mixed_bitfields.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15119> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com