summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBradley M. Froehle <brad.froehle@gmail.com>2013-02-10 10:46:33 -0800
committerBradley M. Froehle <brad.froehle@gmail.com>2013-02-10 10:46:33 -0800
commit92545427dfebaa680ee0f38649d12c1f1c655a7f (patch)
tree659d5af10887cbf527cfafbb3a3a708321bd5092 /numpy
parent625f3cde9aeacea2289ba32286ec54a65f4f4641 (diff)
downloadnumpy-92545427dfebaa680ee0f38649d12c1f1c655a7f.tar.gz
ENH: Use tp_basicsize, not NPY_SIZEOF_PYARRAYOBJECT, for memory allocation.
This change allows C-API level subtypes of PyArray_Type without forcing the developer to rewrite the tp_alloc function and only change the amount of memory allocated.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/arrayobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index 10b750cdb..b559d4aba 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -1655,7 +1655,7 @@ array_alloc(PyTypeObject *type, Py_ssize_t NPY_UNUSED(nitems))
{
PyObject *obj;
/* nitems will always be 0 */
- obj = (PyObject *)PyArray_malloc(NPY_SIZEOF_PYARRAYOBJECT);
+ obj = (PyObject *)PyArray_malloc(type->tp_basicsize);
PyObject_Init(obj, type);
return obj;
}