Issue 14765: the struct example should give consistent results across different hardware platforms (original) (raw)
Issue14765
Created on 2012-05-09 13:51 by tshepang, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg160291 - (view) | Author: Tshepang Lekhonkhobe (tshepang) * | Date: 2012-05-09 13:51 |
This example [1] assumes you are using a specific platform to check it out. I am using amd64, and I get different results. To fix, I prefix the format string with '>': before: pack('hhl', 1, 2, 3) after: pack('>hhl', 1, 2, 3) 1: http://hg.python.org/cpython/file/d3ddbad31b3e/Doc/library/struct.rst#l299 | ||
msg160292 - (view) | Author: Meador Inge (meador.inge) * ![]() |
Date: 2012-05-09 14:07 |
And the examples make an explicit note of that: """ .. note:: All examples assume a native byte order, size, and alignment with a big-endian machine. """ AMD64 is little-endian; the examples are noted to be in big-endian. Is that note not sufficient? | ||
msg160293 - (view) | Author: Tshepang Lekhonkhobe (tshepang) * | Date: 2012-05-09 14:11 |
Sadly, I noticed it only after submitting this report. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:30 | admin | set | github: 58970 |
2012-05-09 14:15:14 | meador.inge | set | status: open -> closedresolution: not a bugstage: resolved |
2012-05-09 14:11:21 | tshepang | set | messages: + |
2012-05-09 14:07:14 | meador.inge | set | messages: + |
2012-05-09 13:51:51 | tshepang | create |