mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
#3560: cleanup C memoryview API
This commit is contained in:
parent
fd036451bf
commit
ee58fa484e
5 changed files with 30 additions and 18 deletions
|
@ -29,7 +29,7 @@ PyDoc_STRVAR(memory_doc,
|
|||
Create a new memoryview object which references the given object.");
|
||||
|
||||
PyObject *
|
||||
PyMemoryView_FromMemory(Py_buffer *info)
|
||||
PyMemoryView_FromBuffer(Py_buffer *info)
|
||||
{
|
||||
PyMemoryViewObject *mview;
|
||||
|
||||
|
@ -231,7 +231,7 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort)
|
|||
mem = PyObject_New(PyMemoryViewObject, &PyMemoryView_Type);
|
||||
if (mem == NULL) return NULL;
|
||||
|
||||
view = &PyMemoryView(mem);
|
||||
view = &mem->view;
|
||||
flags = PyBUF_FULL_RO;
|
||||
switch(buffertype) {
|
||||
case PyBUF_WRITE:
|
||||
|
@ -534,7 +534,7 @@ memory_subscript(PyMemoryViewObject *self, PyObject *key)
|
|||
/* XXX: This needs to be fixed so it
|
||||
actually returns a sub-view
|
||||
*/
|
||||
return PyMemoryView_FromMemory(&newview);
|
||||
return PyMemoryView_FromBuffer(&newview);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1200,7 +1200,7 @@ PyObject *PyUnicode_Decode(const char *s,
|
|||
buffer = NULL;
|
||||
if (PyBuffer_FillInfo(&info, NULL, (void *)s, size, 1, PyBUF_SIMPLE) < 0)
|
||||
goto onError;
|
||||
buffer = PyMemoryView_FromMemory(&info);
|
||||
buffer = PyMemoryView_FromBuffer(&info);
|
||||
if (buffer == NULL)
|
||||
goto onError;
|
||||
unicode = PyCodec_Decode(buffer, encoding, errors);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue