[issue5506] io.BytesIO doesn't support the buffer protocol

Antoine Pitrou report at bugs.python.org
Wed Sep 1 16:48:07 CEST 2010

Antoine Pitrou <pitrou at free.fr> added the comment:

Thinking about it, I'm not sure this would be a good idea to do this by default. There is an ambiguity where it's not obvious if the buffer would contain the whole data or only the bytes after the current position.

I think perhaps an explicit method (getbuffer()?) could be used to export a buffer-compatible object, without copying. Perhaps a memoryview; this would imply defining bf_releasebuffer without bf_getbuffer.

stage: unit test needed -> needs patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list