Pavel Boldin <boldin.pa...@gmail.com> added the comment:

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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12945>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to