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 tim.maxwell
Recipients theller, tim.maxwell
Date 2008-08-12.16:20:01
SpamBayes Score 6.760703e-07
Marked as misclassified No
Message-id <1218558018.93.0.569249577557.issue3547@psf.upfronthosting.co.za>
In-reply-to
Content
Steps to reproduce:

Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *     
>>> fields = [('a', c_short, 4), ('b', c_short, 4), ('c', c_long, 24)]
>>> class Foo(Structure):
...     _fields_ = fields
... 
>>> Foo.a
<Field type=c_short, ofs=0:0, bits=4>
>>> Foo.b
<Field type=c_short, ofs=0:4, bits=4>
>>> Foo.c
<Field type=c_long, ofs=-2:8, bits=24> # Wrong!

More about my machine:
>>> sizeof(c_short)
2
>>> sizeof(c_long)
4

This particular example comes from a 32-bit Mac OS X Intel machine. The 
bug has been reproduced on Linux as well, but could not be reproduced on 
Windows XP.
History
Date User Action Args
2008-08-12 16:20:19tim.maxwellsetrecipients: + tim.maxwell, theller
2008-08-12 16:20:18tim.maxwellsetmessageid: <1218558018.93.0.569249577557.issue3547@psf.upfronthosting.co.za>
2008-08-12 16:20:02tim.maxwelllinkissue3547 messages
2008-08-12 16:20:01tim.maxwellcreate