You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
results in '\x01\x00\x00\x00\x01\x00\x00\x00'
although '\x01\x00\x01\x00\x00\x00' was expected.
if concatenated or done separately
>>> struct.pack('H', 1) + struct.pack('L', 1)
result is as expected '\x01\x00\x01\x00\x00\x00'
or
'\x01\x00' and '\x01\x00\x00\x00' respectively
Error:
Length is 8 where it should be 6
This is as well true for "hl", "hL" and "Hl".
Free description:
I could not find another error regarding that, nor any information using
popular search.
Further no explanation found why that might be valid behaviour.
The struct module is correct.
You see here the result of "alignment": the address of a long is always
a multiple of the size of a long.
The struct module mimics the C compiler: a "struct { short x; long y;
}", will actually occupy 8 bytes in memory (on a 32bit processor).
There are two padding bytes, that are not used.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: