recv_into(bytearray) complains about a "pinned buffer"
andrewdalke at gmail.com
Tue Feb 2 01:02:24 CET 2010
On Feb 2, 12:12 am, Martin v. Loewis wrote:
> My recommendation would be to not use recv_into in 2.x, but only in 3.x.
> I don't think that's the full solution. The array module should also
> implement the new buffer API, so that it would also fail with the old
Okay. But recv_into was added in 2.5 and the test case in
2.6's test_socket.py clearly allows an array there:
buf = array.array('c', ' '*1024)
nbytes = self.cli_conn.recv_into(buf)
msg = buf.tostring()[:len(MSG)]
Checking koders and Google Code search engines, I found one project
which used recv_into, with the filename bmpreceiver.py . It
uses a array.array("B",  * length) .
Clearly it was added to work with an array, and it's
being used with an array. Why shouldn't people use it
with Python 2.x?
dalke at dalkescientific.com
More information about the Python-list