[issue30712] struct.unpack generates wrong error in certain conditions

knzsys report at bugs.python.org
Wed Jun 21 02:11:35 EDT 2017


knzsys added the comment:

just an example, how the pack function behaves with the same format string:

before: 13830108be00cafe....3e05ecbc5138000000043c9be14125359541bf338044000000007452e041.....
after:  13830108be00cafe....3e05ecbc51380000000400003c9be14125359541bf338044000000007452e041....

the pack function inserts 2 0x00 bytes at byte pos 62.

which means the first f item converts to 0x0000AABBCCDD instead to 0xAABBCCDD (float value AABBCCDD is an example).
if the formatstring starts with f it converts to 0xAABBCCDD.

Why this strange behavior?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30712>
_______________________________________


More information about the Python-bugs-list mailing list