Meador Inge added the comment: OK, I finally had some time to look at this. The attached patch does fix the issue. However, it has a nasty side effect in that the encoded bitfield size stays with the field member object:
>>> class SubByte(c_ubyte): pass ... >>> class A(Structure): ... _fields_ = [("x", SubByte, 5)] ... >>> sizeof(A().x) 327680 Before the patch things look like: >>> class SubByte(c_ubyte): pass ... >>> class A(Structure): ... _fields_ = [("x", SubByte, 5)] ... >>> sizeof(A().x) 1 Leaking the internal bitfield size encoding seems like a deal breaker to me. ---------- type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15459> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com