Message8916

Author behackett
Recipients behackett
Date 2014-08-12.23:06:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407884812.57.0.931420050298.issue2188@psf.upfronthosting.co.za>
In-reply-to
Content
Jython 2.7b3 (default:e81256215fb0, Aug 4 2014, 02:39:51) 
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_65
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> b = bytearray(b"\x01\x00\x00\x00")
>>> b
bytearray(b'\x01\x00\x00\x00')
>>> struct.pack_into("<i", b, 0, 5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: pack_into takes an array arg
>>> struct.unpack_from("<i", buffer(b))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unpack_from(): 2nd arg can't be coerced to String


These both work in CPython and pypy

Python 2.7.8 (default, Jul 30 2014, 09:03:23) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> b = bytearray(b"\x01\x00\x00\x00")
>>> struct.pack_into("<i", b, 0, 5)
>>> b
bytearray(b'\x05\x00\x00\x00')
>>> struct.unpack_from("<i", buffer(b))
(5,)
History
Date User Action Args
2014-08-12 23:06:52behackettsetrecipients: + behackett
2014-08-12 23:06:52behackettsetmessageid: <1407884812.57.0.931420050298.issue2188@psf.upfronthosting.co.za>
2014-08-12 23:06:52behackettlinkissue2188 messages
2014-08-12 23:06:51behackettcreate