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 Pavel.Boldin
Recipients Pavel.Boldin, meador.inge
Date 2011-09-11.01:54:58
SpamBayes Score 0.00033493855
Marked as misclassified No
Message-id <1315706099.33.0.741676552645.issue12945@psf.upfronthosting.co.za>
In-reply-to
Content
Yes. Thanks. But here is another error:

import ctypes


class X(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ('a', ctypes.c_ubyte, 4),
        ('b', ctypes.c_ubyte, 4),
        ('c', ctypes.c_ushort, 4),
        ('d', ctypes.c_ushort, 12),
    ]

buf = '\x12\x34\x56\x78'
x = X.from_buffer_copy(buf)

print X.a
print X.b
print X.c
print X.d

print x.a == 2
print x.b == 1
print x.c == 4
print x.d == 0x563


Prints (python 2.7.1):
True
True
True
False

Can you reproduce this?
History
Date User Action Args
2011-09-11 01:54:59Pavel.Boldinsetrecipients: + Pavel.Boldin, meador.inge
2011-09-11 01:54:59Pavel.Boldinsetmessageid: <1315706099.33.0.741676552645.issue12945@psf.upfronthosting.co.za>
2011-09-11 01:54:58Pavel.Boldinlinkissue12945 messages
2011-09-11 01:54:58Pavel.Boldincreate