[issue32648] Wrong byte count with struct

2018-01-24 Thread Christian Heimes
Christian Heimes added the comment: Hardware restrictions, some CPUs require types to be aligned in certain ways. Doubles must be aligned by multiple of 8 bytes. Please read https://en.wikipedia.org/wiki/Data_structure_alignment and use the Python users mailing list for further questions. --

[issue32648] Wrong byte count with struct

2018-01-24 Thread Róbert Lexmann
Róbert Lexmann added the comment: Thanks for a fast response. If I may ask, what is it good for to encode 'id' in 16 bytes and 'di' in 12? Rob On 01/24/2018 12:00 PM, Christian Heimes wrote: > Christian Heimes added the comment: > > It's not a bug. Please read the section about padding. > >>

[issue32648] Wrong byte count with struct

2018-01-24 Thread Christian Heimes
Christian Heimes added the comment: It's not a bug. Please read the section about padding. >>> struct.calcsize('id') 16 >>> struct.calcsize('>id') 12 -- nosy: +christian.heimes resolution: -> not a bug stage: -> resolved status: open -> closed ___

[issue32648] Wrong byte count with struct

2018-01-24 Thread Róbert Lexmann
New submission from Róbert Lexmann : struct.pack('id',a,b) returns 16 bytes, should return 4+8=12 bytes. struct.calcsize('id') also returns 16. -- messages: 310584 nosy: Róbert Lexmann priority: normal severity: normal status: open title: Wrong byte count with struct type: behavior vers