@@ -218,8 +218,9 @@ ndarray_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
218218}
219219
220220static void
221- ndarray_dealloc (NDArrayObject * self )
221+ ndarray_dealloc (PyObject * op )
222222{
223+ NDArrayObject * self = (NDArrayObject * )op ;
223224 if (self -> head ) {
224225 if (ND_IS_CONSUMER (self )) {
225226 Py_buffer * base = & self -> head -> base ;
@@ -1413,8 +1414,9 @@ ndarray_pop(PyObject *self, PyObject *dummy)
14131414/**************************************************************************/
14141415
14151416static int
1416- ndarray_getbuf (NDArrayObject * self , Py_buffer * view , int flags )
1417+ ndarray_getbuf (PyObject * op , Py_buffer * view , int flags )
14171418{
1419+ NDArrayObject * self = (NDArrayObject * )op ;
14181420 ndbuf_t * ndbuf = self -> head ;
14191421 Py_buffer * base = & ndbuf -> base ;
14201422 int baseflags = ndbuf -> flags ;
@@ -1530,8 +1532,9 @@ ndarray_getbuf(NDArrayObject *self, Py_buffer *view, int flags)
15301532}
15311533
15321534static void
1533- ndarray_releasebuf (NDArrayObject * self , Py_buffer * view )
1535+ ndarray_releasebuf (PyObject * op , Py_buffer * view )
15341536{
1537+ NDArrayObject * self = (NDArrayObject * )op ;
15351538 if (!ND_IS_CONSUMER (self )) {
15361539 ndbuf_t * ndbuf = view -> internal ;
15371540 if (-- ndbuf -> exports == 0 && ndbuf != self -> head )
@@ -1540,8 +1543,8 @@ ndarray_releasebuf(NDArrayObject *self, Py_buffer *view)
15401543}
15411544
15421545static PyBufferProcs ndarray_as_buffer = {
1543- ( getbufferproc ) ndarray_getbuf , /* bf_getbuffer */
1544- ( releasebufferproc ) ndarray_releasebuf /* bf_releasebuffer */
1546+ ndarray_getbuf , /* bf_getbuffer */
1547+ ndarray_releasebuf , /* bf_releasebuffer */
15451548};
15461549
15471550
@@ -1998,21 +2001,24 @@ ssize_array_as_tuple(Py_ssize_t *array, Py_ssize_t len)
19982001}
19992002
20002003static PyObject *
2001- ndarray_get_flags (NDArrayObject * self , void * closure )
2004+ ndarray_get_flags (PyObject * op , void * closure )
20022005{
2006+ NDArrayObject * self = (NDArrayObject * )op ;
20032007 return PyLong_FromLong (self -> head -> flags );
20042008}
20052009
20062010static PyObject *
2007- ndarray_get_offset (NDArrayObject * self , void * closure )
2011+ ndarray_get_offset (PyObject * op , void * closure )
20082012{
2013+ NDArrayObject * self = (NDArrayObject * )op ;
20092014 ndbuf_t * ndbuf = self -> head ;
20102015 return PyLong_FromSsize_t (ndbuf -> offset );
20112016}
20122017
20132018static PyObject *
2014- ndarray_get_obj (NDArrayObject * self , void * closure )
2019+ ndarray_get_obj (PyObject * op , void * closure )
20152020{
2021+ NDArrayObject * self = (NDArrayObject * )op ;
20162022 Py_buffer * base = & self -> head -> base ;
20172023
20182024 if (base -> obj == NULL ) {
@@ -2022,64 +2028,72 @@ ndarray_get_obj(NDArrayObject *self, void *closure)
20222028}
20232029
20242030static PyObject *
2025- ndarray_get_nbytes (NDArrayObject * self , void * closure )
2031+ ndarray_get_nbytes (PyObject * op , void * closure )
20262032{
2033+ NDArrayObject * self = (NDArrayObject * )op ;
20272034 Py_buffer * base = & self -> head -> base ;
20282035 return PyLong_FromSsize_t (base -> len );
20292036}
20302037
20312038static PyObject *
2032- ndarray_get_readonly (NDArrayObject * self , void * closure )
2039+ ndarray_get_readonly (PyObject * op , void * closure )
20332040{
2041+ NDArrayObject * self = (NDArrayObject * )op ;
20342042 Py_buffer * base = & self -> head -> base ;
20352043 return PyBool_FromLong (base -> readonly );
20362044}
20372045
20382046static PyObject *
2039- ndarray_get_itemsize (NDArrayObject * self , void * closure )
2047+ ndarray_get_itemsize (PyObject * op , void * closure )
20402048{
2049+ NDArrayObject * self = (NDArrayObject * )op ;
20412050 Py_buffer * base = & self -> head -> base ;
20422051 return PyLong_FromSsize_t (base -> itemsize );
20432052}
20442053
20452054static PyObject *
2046- ndarray_get_format (NDArrayObject * self , void * closure )
2055+ ndarray_get_format (PyObject * op , void * closure )
20472056{
2057+ NDArrayObject * self = (NDArrayObject * )op ;
20482058 Py_buffer * base = & self -> head -> base ;
20492059 const char * fmt = base -> format ? base -> format : "" ;
20502060 return PyUnicode_FromString (fmt );
20512061}
20522062
20532063static PyObject *
2054- ndarray_get_ndim (NDArrayObject * self , void * closure )
2064+ ndarray_get_ndim (PyObject * op , void * closure )
20552065{
2066+ NDArrayObject * self = (NDArrayObject * )op ;
20562067 Py_buffer * base = & self -> head -> base ;
20572068 return PyLong_FromSsize_t (base -> ndim );
20582069}
20592070
20602071static PyObject *
2061- ndarray_get_shape (NDArrayObject * self , void * closure )
2072+ ndarray_get_shape (PyObject * op , void * closure )
20622073{
2074+ NDArrayObject * self = (NDArrayObject * )op ;
20632075 Py_buffer * base = & self -> head -> base ;
20642076 return ssize_array_as_tuple (base -> shape , base -> ndim );
20652077}
20662078
20672079static PyObject *
2068- ndarray_get_strides (NDArrayObject * self , void * closure )
2080+ ndarray_get_strides (PyObject * op , void * closure )
20692081{
2082+ NDArrayObject * self = (NDArrayObject * )op ;
20702083 Py_buffer * base = & self -> head -> base ;
20712084 return ssize_array_as_tuple (base -> strides , base -> ndim );
20722085}
20732086
20742087static PyObject *
2075- ndarray_get_suboffsets (NDArrayObject * self , void * closure )
2088+ ndarray_get_suboffsets (PyObject * op , void * closure )
20762089{
2090+ NDArrayObject * self = (NDArrayObject * )op ;
20772091 Py_buffer * base = & self -> head -> base ;
20782092 return ssize_array_as_tuple (base -> suboffsets , base -> ndim );
20792093}
20802094
20812095static PyObject *
2082- ndarray_c_contig (PyObject * self , PyObject * dummy )
2096+ ndarray_c_contig (PyObject * self , void * dummy )
20832097{
20842098 NDArrayObject * nd = (NDArrayObject * )self ;
20852099 int ret = PyBuffer_IsContiguous (& nd -> head -> base , 'C' );
@@ -2093,7 +2107,7 @@ ndarray_c_contig(PyObject *self, PyObject *dummy)
20932107}
20942108
20952109static PyObject *
2096- ndarray_fortran_contig (PyObject * self , PyObject * dummy )
2110+ ndarray_fortran_contig (PyObject * self , void * dummy )
20972111{
20982112 NDArrayObject * nd = (NDArrayObject * )self ;
20992113 int ret = PyBuffer_IsContiguous (& nd -> head -> base , 'F' );
@@ -2107,7 +2121,7 @@ ndarray_fortran_contig(PyObject *self, PyObject *dummy)
21072121}
21082122
21092123static PyObject *
2110- ndarray_contig (PyObject * self , PyObject * dummy )
2124+ ndarray_contig (PyObject * self , void * dummy )
21112125{
21122126 NDArrayObject * nd = (NDArrayObject * )self ;
21132127 int ret = PyBuffer_IsContiguous (& nd -> head -> base , 'A' );
@@ -2124,21 +2138,21 @@ ndarray_contig(PyObject *self, PyObject *dummy)
21242138static PyGetSetDef ndarray_getset [] =
21252139{
21262140 /* ndbuf */
2127- { "flags" , ( getter ) ndarray_get_flags , NULL , NULL , NULL },
2128- { "offset" , ( getter ) ndarray_get_offset , NULL , NULL , NULL },
2141+ { "flags" , ndarray_get_flags , NULL , NULL , NULL },
2142+ { "offset" , ndarray_get_offset , NULL , NULL , NULL },
21292143 /* ndbuf.base */
2130- { "obj" , ( getter ) ndarray_get_obj , NULL , NULL , NULL },
2131- { "nbytes" , ( getter ) ndarray_get_nbytes , NULL , NULL , NULL },
2132- { "readonly" , ( getter ) ndarray_get_readonly , NULL , NULL , NULL },
2133- { "itemsize" , ( getter ) ndarray_get_itemsize , NULL , NULL , NULL },
2134- { "format" , ( getter ) ndarray_get_format , NULL , NULL , NULL },
2135- { "ndim" , ( getter ) ndarray_get_ndim , NULL , NULL , NULL },
2136- { "shape" , ( getter ) ndarray_get_shape , NULL , NULL , NULL },
2137- { "strides" , ( getter ) ndarray_get_strides , NULL , NULL , NULL },
2138- { "suboffsets" , ( getter ) ndarray_get_suboffsets , NULL , NULL , NULL },
2139- { "c_contiguous" , ( getter ) ndarray_c_contig , NULL , NULL , NULL },
2140- { "f_contiguous" , ( getter ) ndarray_fortran_contig , NULL , NULL , NULL },
2141- { "contiguous" , ( getter ) ndarray_contig , NULL , NULL , NULL },
2144+ { "obj" , ndarray_get_obj , NULL , NULL , NULL },
2145+ { "nbytes" , ndarray_get_nbytes , NULL , NULL , NULL },
2146+ { "readonly" , ndarray_get_readonly , NULL , NULL , NULL },
2147+ { "itemsize" , ndarray_get_itemsize , NULL , NULL , NULL },
2148+ { "format" , ndarray_get_format , NULL , NULL , NULL },
2149+ { "ndim" , ndarray_get_ndim , NULL , NULL , NULL },
2150+ { "shape" , ndarray_get_shape , NULL , NULL , NULL },
2151+ { "strides" , ndarray_get_strides , NULL , NULL , NULL },
2152+ { "suboffsets" , ndarray_get_suboffsets , NULL , NULL , NULL },
2153+ { "c_contiguous" , ndarray_c_contig , NULL , NULL , NULL },
2154+ { "f_contiguous" , ndarray_fortran_contig , NULL , NULL , NULL },
2155+ { "contiguous" , ndarray_contig , NULL , NULL , NULL },
21422156 {NULL }
21432157};
21442158
@@ -2623,7 +2637,7 @@ ndarray_hash(PyObject *self)
26232637}
26242638
26252639
2626- static PyMethodDef ndarray_methods [] =
2640+ static PyMethodDef ndarray_methods [] =
26272641{
26282642 { "tolist" , ndarray_tolist , METH_NOARGS , NULL },
26292643 { "tobytes" , ndarray_tobytes , METH_NOARGS , NULL },
@@ -2639,7 +2653,7 @@ static PyTypeObject NDArray_Type = {
26392653 "ndarray" , /* Name of this type */
26402654 sizeof (NDArrayObject ), /* Basic object size */
26412655 0 , /* Item size for varobject */
2642- ( destructor ) ndarray_dealloc , /* tp_dealloc */
2656+ ndarray_dealloc , /* tp_dealloc */
26432657 0 , /* tp_vectorcall_offset */
26442658 0 , /* tp_getattr */
26452659 0 , /* tp_setattr */
@@ -2648,7 +2662,7 @@ static PyTypeObject NDArray_Type = {
26482662 0 , /* tp_as_number */
26492663 & ndarray_as_sequence , /* tp_as_sequence */
26502664 & ndarray_as_mapping , /* tp_as_mapping */
2651- ( hashfunc ) ndarray_hash , /* tp_hash */
2665+ ndarray_hash , /* tp_hash */
26522666 0 , /* tp_call */
26532667 0 , /* tp_str */
26542668 PyObject_GenericGetAttr , /* tp_getattro */
0 commit comments