diff options
author | njsmith <njs@pobox.com> | 2012-07-11 06:53:45 -0700 |
---|---|---|
committer | njsmith <njs@pobox.com> | 2012-07-11 06:53:45 -0700 |
commit | 8ecb4b23bcef5b9e004d8c175e7d6ae473751907 (patch) | |
tree | 540a912f2658d807e99555035386b21393280a7e /numpy/lib | |
parent | 64c3a8f464e1b187aef833dda5ad0ce7dba44ef4 (diff) | |
parent | b42653982c7e8a093369ec9b1cf6088e47c29904 (diff) | |
download | numpy-8ecb4b23bcef5b9e004d8c175e7d6ae473751907.tar.gz |
Merge pull request #309 from thouis/malloc_hooks
ENH: expose PyDataMem_NEW/FREE/RENEW as numpy API functions with an event hook.
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/src/_compiled_base.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c index c31ee5cd8..9bb8a613d 100644 --- a/numpy/lib/src/_compiled_base.c +++ b/numpy/lib/src/_compiled_base.c @@ -670,7 +670,10 @@ arr_interp(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) /* only pre-calculate slopes if there are relatively few of them. */ if (lenxp <= lenx) { - slopes = (double *) PyDataMem_NEW((lenxp - 1)*sizeof(double)); + slopes = (double *) PyArray_malloc((lenxp - 1)*sizeof(double)); + if (! slopes) { + goto fail; + } NPY_BEGIN_ALLOW_THREADS; for (i = 0; i < lenxp - 1; i++) { slopes[i] = (dy[i + 1] - dy[i])/(dx[i + 1] - dx[i]); @@ -692,7 +695,7 @@ arr_interp(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) } } NPY_END_ALLOW_THREADS; - PyDataMem_FREE(slopes); + PyArray_free(slopes); } else { NPY_BEGIN_ALLOW_THREADS; |