[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-12 Thread Pavel Boldin
Pavel Boldin boldin.pa...@gmail.com added the comment: We have raw data packages from some tools. These packages contains bitfields, arrays, simple data and so on. We want to parse them into Python objects (structures) for analysis and storage. I tried to use ctypes, but now I wrote myself

[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-11 Thread Pavel Boldin
Pavel Boldin boldin.pa...@gmail.com added the comment: OK. So, it seems just like ctypes work, but don't for my needs. Thing that bothers me anyway is the strange code, where size contains either size (when bitsize==0) or bitsize in upper 16 bits and bitoffset in lower 16 bits

[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-10 Thread Pavel Boldin
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

[issue12945] ctypes works incorrectly with _swappedbytes_ = 1

2011-09-09 Thread Pavel Boldin
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