[Python-Dev] Why does _pyio.*.readinto have to work with 'b' arrays?

Victor Stinner victor.stinner at gmail.com
Sun Jun 15 11:31:43 CEST 2014


Le 15 juin 2014 02:42, "Benjamin Peterson" <benjamin at python.org> a écrit :
> On Sat, Jun 14, 2014, at 15:39, Nikolaus Rath wrote:
> > It seems to me that a much cleaner solution would be to simply declare
> > _pyio's readinto to only work with bytearrays, and to explicitly raise a
> > (more helpful) TypeError if anything else is passed in.
>
> That seems reasonable. I don't think _pyio's behavior is terribly
> important compared to the C _io module.

Which types are accepted by the readinto() method of the C io module? If
the C module only accepts bytearray, the array hack must be removed from
_pyio.

The _pyio module is mostly used for testing purpose, it's much slower. I
hope that nobody uses it in production, the module is private (underscore
prefix). So it's fine to break backward compatibilty to have the same
behaviour then the C module.

Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140615/16300223/attachment.html>


More information about the Python-Dev mailing list