Change PyBuffer to Py_buffer to be consistent with other non-object structures like Py_complex. Add some more functionality to the memoryview object.
diff --git a/Include/abstract.h b/Include/abstract.h
index c3c8fd1..38628bb 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -542,7 +542,7 @@
/* Return 1 if the getbuffer function is available, otherwise
return 0 */
- PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, PyBuffer *view,
+ PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
/* This is a C-API version of the getbuffer function call. It checks
@@ -552,7 +552,7 @@
*/
- PyAPI_FUNC(void) PyObject_ReleaseBuffer(PyObject *obj, PyBuffer *view);
+ PyAPI_FUNC(void) PyObject_ReleaseBuffer(PyObject *obj, Py_buffer *view);
/* C-API version of the releasebuffer function call. It
@@ -570,7 +570,7 @@
buffer
*/
- PyAPI_FUNC(void *) PyBuffer_GetPointer(PyBuffer *view, Py_ssize_t *indices);
+ PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices);
/* Get the memory area pointed to by the indices for the buffer given.
Note that view->ndim is the assumed size of indices
@@ -583,10 +583,10 @@
- PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, PyBuffer *view,
+ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view,
Py_ssize_t len, char fort);
- PyAPI_FUNC(int) PyBuffer_FromContiguous(PyBuffer *view, void *buf,
+ PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf,
Py_ssize_t len, char fort);
@@ -611,7 +611,7 @@
/* Copy the data from the src buffer to the buffer of destination
*/
- PyAPI_FUNC(int) PyBuffer_IsContiguous(PyBuffer *view, char fortran);
+ PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fortran);
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
@@ -626,7 +626,7 @@
per element.
*/
- PyAPI_FUNC(int) PyBuffer_FillInfo(PyBuffer *view, void *buf,
+ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, void *buf,
Py_ssize_t len, int readonly,
int flags);
diff --git a/Include/memoryobject.h b/Include/memoryobject.h
index 1713e8f..4426cd8 100644
--- a/Include/memoryobject.h
+++ b/Include/memoryobject.h
@@ -10,7 +10,7 @@
typedef struct {
PyObject_HEAD
PyObject *base;
- PyBuffer view;
+ Py_buffer view;
} PyMemoryViewObject;
@@ -57,7 +57,7 @@
PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base);
-PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(PyBuffer *info);
+PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(Py_buffer *info);
/* create new if bufptr is NULL
will be a new bytesobject in base */
diff --git a/Include/object.h b/Include/object.h
index d03c888..88a3b84 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -153,10 +153,10 @@
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
-} PyBuffer;
+} Py_buffer;
-typedef int (*getbufferproc)(PyObject *, PyBuffer *, int);
-typedef void (*releasebufferproc)(PyObject *, PyBuffer *);
+typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
+typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
/* Flags for getting buffers */
#define PyBUF_SIMPLE 0