This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients cvrebert, eric.smith, jcea, mark.dickinson, python-dev, regehr, skrah
Date 2012-06-21.08:01:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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>
Date User Action Args
2012-06-21 08:01:07mark.dickinsonsetrecipients: + mark.dickinson, jcea, eric.smith, cvrebert, skrah, regehr, python-dev
2012-06-21 08:01:07mark.dickinsonsetmessageid: <>
2012-06-21 08:01:07mark.dickinsonlinkissue9530 messages
2012-06-21 08:01:06mark.dickinsoncreate