You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ctypes.Structure superclass with bitfields do not parse properly when it doesn't end on a byte boundary #117942
I am trying to extend a ctypes Structure in a subclass but am running into some issues. My parent class defines bitfields that are intended to be expanded in the child class to fill the byte boundary.
importctypesclassParent(ctypes.BigEndianStructure):
_pack_=1_fields_= [
("field1", ctypes.c_uint8, 8),
("field2", ctypes.c_uint8, 6),
]
classChild(Parent):
_pack_=1_fields_= [
("field3", ctypes.c_uint8, 2), # fills the missing bits from the parent
("field4", ctypes.c_uint16, 16)
]
When I run the following to test, I am not getting the expected values.
Activity