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 wbu
Recipients mark.dickinson, meador.inge, wbu
Date 2014-07-16.18:52:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405536762.24.0.579757488984.issue15119@psf.upfronthosting.co.za>
In-reply-to
Content
I just run into this issue, so i'll bump it with another test case:

import ctypes

class Struct(ctypes.Structure):
    _fields_ = [
        ("uint8_0", ctypes.c_uint8, 8),
        ("uint8_1", ctypes.c_uint8, 8),
        ("uint16_0", ctypes.c_uint16, 1),
        ("uint16_1", ctypes.c_uint16, 15),
    ]

for f in Struct._fields_:
    print f[0], getattr(Struct, f[0])

> python bitfield.py 
uint8_0 <Field type=c_ubyte, ofs=0:0, bits=8>
uint8_1 <Field type=c_ubyte, ofs=1:0, bits=8>
uint16_0 <Field type=c_ushort, ofs=1:8, bits=1>
uint16_1 <Field type=c_ushort, ofs=4:0, bits=15>


Originally tested with Python 2.7.3, but also confirmed with later versions.

Is there any workaround by specifying ofs and bits manually?
History
Date User Action Args
2014-07-16 18:52:42wbusetrecipients: + wbu, mark.dickinson, meador.inge
2014-07-16 18:52:42wbusetmessageid: <1405536762.24.0.579757488984.issue15119@psf.upfronthosting.co.za>
2014-07-16 18:52:42wbulinkissue15119 messages
2014-07-16 18:52:42wbucreate