New submission from Daniel Stutzbach <dan...@stutzbachenterprises.com>:
The following program should print "0xdead" but instead prints "0x0". This came from the following stackoverflow question: http://stackoverflow.com/questions/3824617/python-structure-always-stuck-at-0-no-matter-what-value-you-assign-to-it import ctypes class Blah(ctypes.Structure): _fields_ = [("a", ctypes.c_uint64, 64), ("b", ctypes.c_uint16, 16), ("c", ctypes.c_uint8, 8), ("d", ctypes.c_uint8, 8)] x = Blah(0xDEAD,0xBEEF,0x44,0x12) print(hex(x.a)) ---------- components: Library (Lib) messages: 117637 nosy: stutzbach, theller priority: normal severity: normal stage: unit test needed status: open title: ctypes bitfield problem type: behavior versions: Python 2.7, Python 3.1, Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9989> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com