New submission from Pavel Boldin <boldin.pa...@gmail.com>: ctypes seems to work incorrectly with _swappedbytes_ specified.
I.e. it misses some values from buffer: class X(ctypes.Structure): _swappedbytes_ = 1 _pack_ = 1 _fields_ = [ ('a', ctypes.c_ubyte, 4), ('b', ctypes.c_ubyte, 4), ('c', ctypes.c_ushort, 8), ('d', ctypes.c_ushort, 8), ] buf = '\x12\x34\x56\x78' x = X.from_buffer_copy(buf) print x.a == 1 print x.b == 2 print x.c == 3 print x.d == 4 This prints True True False False Where as four 'True' are expected. ---------- components: ctypes files: test_ctypes.py messages: 143761 nosy: Pavel.Boldin priority: normal severity: normal status: open title: ctypes works incorrectly with _swappedbytes_ = 1 versions: Python 2.7, Python 3.1 Added file: http://bugs.python.org/file23122/test_ctypes.py _______________________________________ 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