recv_into(bytearray) complains about a "pinned buffer"

Martin v. Loewis martin at v.loewis.de
Mon Feb 1 18:12:34 EST 2010


Antoine Pitrou wrote:
> Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit :
>>> Is this a bug in Python 2.6 or a deliberate choice regarding
>>> implementation concerns I don't know about?
>> It's actually a bug also that you pass an array; doing so *should* give
>> the very same error.
> 
> Well, if you can give neither an array nor a bytearray to recv_into(), 
> what *could* you give it?

My recommendation would be to not use recv_into in 2.x, but only in 3.x.

> recv_into() should simply be fixed to use the new buffer API, as it does 
> 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
recv_into.

Regards,
Martin



More information about the Python-list mailing list