msg119683 - (view) |
Author: Kristján Valur Jónsson (kristjan.jonsson) *  |
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) *  |
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) *  |
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) *  |
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) *  |
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) *  |
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) *  |
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)  |
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 |
|
|