[docs] bug in python struct package

Danielle Sanders DSanders at hbk.com
Thu Jul 23 19:43:20 CEST 2015


If you run the following python on 3.3, the contents of altogether_output.bin has 4 extra bytes.  These should be logically identical.


import struct

with open('separated_output.bin', 'wb') as f:
    f.write(struct.pack('L12sQ', 1* 1000, bytes("ABCDEFGH", "UTF-8"), 2))
    f.write(struct.pack('L', 3))
    f.write(struct.pack('4Q4x', 4, 5, 6, 7))

with open('alltogether_output.bin', 'wb') as f:
    f.write(struct.pack('L12sQL4Q4x', 1* 1000, bytes("ABCDEFGH", "UTF-8"), 2, 3, 4, 5, 6, 7))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20150723/05aa0fd6/attachment-0001.html>


More information about the docs mailing list