diff options
author | Ronan Lamy <ronan.lamy@gmail.com> | 2021-10-22 19:58:24 +0100 |
---|---|---|
committer | Ronan Lamy <ronan.lamy@gmail.com> | 2021-10-22 19:58:24 +0100 |
commit | aa232f68943ef23be298e2be824e97ad7e174ed4 (patch) | |
tree | 523950fe4badb26b9a8733e12a24d18f75835aa4 | |
parent | 53d2a831668a58aa069e3bd891dd9d342dd058b3 (diff) | |
download | numpy-aa232f68943ef23be298e2be824e97ad7e174ed4.tar.gz |
MAINT: Remove useless custom tp_alloc and tp_free on ndarray
array_alloc is equivalent to the default object allocator
PyType_GenericAlloc. array_free was added "just in case" in e9ebefec but
doesn't seem to serve any actual purpose.
-rw-r--r-- | numpy/core/src/multiarray/arrayobject.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index 9b9df08f2..28aff5d65 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -1705,22 +1705,6 @@ array_iter(PyArrayObject *arr) return PySeqIter_New((PyObject *)arr); } -static PyObject * -array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems)) -{ - /* nitems will always be 0 */ - PyObject *obj = PyObject_Malloc(type->tp_basicsize); - PyObject_Init(obj, type); - return obj; -} - -static void -array_free(PyObject * v) -{ - /* avoid same deallocator as PyBaseObject, see gentype_free */ - PyObject_Free(v); -} - NPY_NO_EXPORT PyTypeObject PyArray_Type = { PyVarObject_HEAD_INIT(NULL, 0) @@ -1741,7 +1725,5 @@ NPY_NO_EXPORT PyTypeObject PyArray_Type = { .tp_iter = (getiterfunc)array_iter, .tp_methods = array_methods, .tp_getset = array_getsetlist, - .tp_alloc = (allocfunc)array_alloc, .tp_new = (newfunc)array_new, - .tp_free = (freefunc)array_free, }; |