[New-bugs-announce] [issue9989] ctypes bitfield problem

Daniel Stutzbach report at bugs.python.org
Wed Sep 29 20:34:54 CEST 2010

New submission from Daniel Stutzbach <daniel at stutzbachenterprises.com>:

The following program should print "0xdead" but instead prints "0x0".  This came from the following stackoverflow question:

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)

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list