Author bsder
Recipients bsder
Date 2014-02-28.09:17:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393579049.39.0.501282349647.issue20803@psf.upfronthosting.co.za>
In-reply-to
Content
This code did something unexpected to me:
>>> a = bytearray('1234')
>>> a
bytearray(b'1234')
>>> struct.pack_into('xBxB', a, 0, 0x59, 0x5A)
>>> a
bytearray(b'\x00Y\x00Z')


The unexpected part was that the 'x' pad byte formatter actually *overwrote* the bytes to 0 rather than leaving them alone.

Not necessarily a bug, but the fact that the pad byte writes 0x00 rather than being untouched/ignored should be documented.
History
Date User Action Args
2014-02-28 09:17:29bsdersetrecipients: + bsder
2014-02-28 09:17:29bsdersetmessageid: <1393579049.39.0.501282349647.issue20803@psf.upfronthosting.co.za>
2014-02-28 09:17:29bsderlinkissue20803 messages
2014-02-28 09:17:28bsdercreate