This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Henning.von.Bargen, benjamin.peterson, docs@python, martin.panter, pitrou, python-dev, r.david.murray, serhiy.storchaka
Date 2016-06-03.09:59:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464947953.07.0.919133525553.issue20699@psf.upfronthosting.co.za>
In-reply-to
Content
I don’t see the point of mentioning array() objects at all. It’s hard to support array in a Python 2 implementation, as demonstrated by readinto(). And the special support for array('b') won’t help if you pass in array('B') with values 128–255. I see this as an implementation detail of _pyio, rather than a need for others to follow its lead.

The array('b') code was added by r56225. I guess it is experimental code from an early phase of the io module. Also, test_array_writes() is disabled for _pyio in 2.7 (https://hg.python.org/cpython/diff/760a710eb6c1/Lib/test/test_io.py), and in 2.6 (http://svn.python.org/view/python/branches/trunk-bytearray/Lib/test/test_io.py?r1=61775&r2=61774&pathrev=61775&view=patch).

I think it is better to avoid “such as” and be specific about what has to be supported. Perhaps:

readinto(b): The object *b* should be a pre-allocated, writable array of bytes, either :class:`bytearray` or :class:`memoryview`.

.. versionchanged:: 2.7
   Support for :class:`memoryview`.

write(b): The object *b* should be an array of bytes, either :class:`str`, :class:`bytearray`, or :class:`memoryview`.

.. versionchanged:: 2.7
   Support for :class:`memoryview`.
History
Date User Action Args
2016-06-03 09:59:13martin.pantersetrecipients: + martin.panter, pitrou, benjamin.peterson, r.david.murray, docs@python, python-dev, serhiy.storchaka, Henning.von.Bargen
2016-06-03 09:59:13martin.pantersetmessageid: <1464947953.07.0.919133525553.issue20699@psf.upfronthosting.co.za>
2016-06-03 09:59:13martin.panterlinkissue20699 messages
2016-06-03 09:59:12martin.pantercreate