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 stutzbach
Recipients stutzbach, theller
Date 2010-09-29.18:34:51
SpamBayes Score 0.025914328
Marked as misclassified No
Message-id <1285785294.07.0.231109223206.issue9989@psf.upfronthosting.co.za>
In-reply-to
Content
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))
History
Date User Action Args
2010-09-29 18:34:54stutzbachsetrecipients: + stutzbach, theller
2010-09-29 18:34:54stutzbachsetmessageid: <1285785294.07.0.231109223206.issue9989@psf.upfronthosting.co.za>
2010-09-29 18:34:52stutzbachlinkissue9989 messages
2010-09-29 18:34:51stutzbachcreate