Mercurial > cpython-lru_cache-weakref
diff Objects/memoryobject.c @ 48623:bf50085fbcd3
#2538: bytes objects can only provide read-only buffers
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 02 Aug 2008 21:02:48 +0000 |
| parents | ac854cde3135 |
| children | cd3b0b7fd8e1 |
line wrap: on
line diff
--- a/Objects/memoryobject.c Sat Aug 02 16:34:27 2008 +0000 +++ b/Objects/memoryobject.c Sat Aug 02 21:02:48 2008 +0000 @@ -56,7 +56,7 @@ if (mview == NULL) return NULL; mview->base = NULL; - if (PyObject_GetBuffer(base, &(mview->view), PyBUF_FULL) < 0) { + if (PyObject_GetBuffer(base, &(mview->view), PyBUF_FULL_RO) < 0) { Py_DECREF(mview); return NULL; } @@ -204,9 +204,9 @@ a contiguous buffer if it is not. The view will point to the shadow buffer which can be written to and then will be copied back into the other buffer when the memory - view is de-allocated. While the shadow buffer is - being used, it will have an exclusive write lock on - the original buffer. + view is de-allocated. While the shadow buffer is + being used, it will have an exclusive write lock on + the original buffer. */ PyObject * @@ -528,7 +528,7 @@ /* Return a new memory-view object */ Py_buffer newview; memset(&newview, 0, sizeof(newview)); - /* XXX: This needs to be fixed so it + /* XXX: This needs to be fixed so it actually returns a sub-view */ return PyMemoryView_FromMemory(&newview);
