Issue 10211: BufferObject doesn't support new buffer interface (original) (raw)

Issue10211

Created on 2010-10-27 08:49 by kristjan.jonsson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
buffer_newbuf.patch kristjan.jonsson,2010-10-27 08:49 review
Messages (9)
msg119683 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2010-10-27 08:49
The BufferObject in 2.7 doesn't support the new buffer interface. This makes it useless for use with the new memoryview object. This simple patch adds that support.
msg119691 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-10-27 11:25
Unless there is a mismatch between the documentation and the code, I suspect this will be rejected by the release manager.
msg119714 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2010-10-27 14:40
Well, we can always fix the documentation, then :) Seriously, having two different buffer interfaces in the interpreter core that can only communicate through weird middle men (like str()) should be considered a bug. There shouldn't be any surprises like this. Simple is better than complex.
msg119721 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-10-27 17:08
The memoryview object was added to simplify porting applications to Python3. If that backport is incomplete in the sense that the memoryview object is not compatible with the standard Python2 object for such memory views, then I'd consider that a bug. Without compatibility to the buffer objects, there's no way to make other Python2 buffer interface compatible object compatible to memoryviews. Alternatively, the Python2 memoryview object implementation could also accept objects with the old buffer interface, much like "s*" does. Note that the patch needs to check the buffer flags - writing to such buffers is not allowed.
msg119749 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2010-10-28 01:28
Do you mean that we should disable writing for the new style buffer interface? Currently the patch respects the Buffer object's read-only flag (self->b_readonly): static int buffer_getbuffer(PyBufferObject *self, Py_buffer *buf, int flags) { void *ptr; Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return -1; return PyBuffer_FillInfo(buf, (PyObject*)self, ptr, size, self->b_readonly, flags); }
msg156388 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2012-03-20 09:12
Bumping this. Do we want this fixed as a bug in 2.7 or left alone?
msg184527 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2013-03-18 21:20
Bump, 2.7.4 will be cut next week ...
msg184561 - (view) Author: Tres Seaver (tseaver) * Date: 2013-03-19 00:05
Looks good to me.
msg184716 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-20 00:40
New changeset 6b3217b96a77 by Kristján Valur Jónsson in branch '2.7': Issue #10211 : Buffer object should support the new buffer interface. http://hg.python.org/cpython/rev/6b3217b96a77
History
Date User Action Args
2022-04-11 14:57:07 admin set github: 54420
2013-03-22 22:53:21 Arfrever set stage: resolved
2013-03-22 17:26:10 kristjan.jonsson set status: open -> closedresolution: fixed
2013-03-20 00:40:30 python-dev set nosy: + python-devmessages: +
2013-03-19 00:12:10 Arfrever set nosy: + Arfrever
2013-03-19 00:05:34 tseaver set nosy: + tseavermessages: +
2013-03-18 21:20:34 kristjan.jonsson set messages: +
2012-03-20 09:12:02 kristjan.jonsson set messages: +
2012-02-09 22:45:55 skrah set nosy: + skrah
2010-10-28 13:53:12 eric.araujo set nosy: + pitrou
2010-10-28 01:28:42 kristjan.jonsson set messages: +
2010-10-27 17:08:29 lemburg set nosy: + lemburgmessages: +
2010-10-27 14:40:01 kristjan.jonsson set messages: +
2010-10-27 11:25:10 eric.araujo set nosy: + eric.araujo, benjamin.petersonmessages: +
2010-10-27 08:49:10 kristjan.jonsson create