summaryrefslogtreecommitdiff
path: root/numpy/lib/src
diff options
context:
space:
mode:
authorAron Ahmadia <aron@ahmadia.net>2012-07-17 16:59:50 -0500
committerAron Ahmadia <aron@ahmadia.net>2012-07-17 16:59:50 -0500
commita419a3036aa8202d00eb6e857c79d66adc56bed0 (patch)
tree4a73e6fff2ee13b35c154c43bd7b58bb6c2af633 /numpy/lib/src
parent7316499dd60baa7bb260875b79f7d22be491c986 (diff)
parent6c772fab57934d24b66638ea5001eb02d1662f5e (diff)
downloadnumpy-a419a3036aa8202d00eb6e857c79d66adc56bed0.tar.gz
Merge branch 'master' of https://github.com/numpy/numpy into patch-2
Diffstat (limited to 'numpy/lib/src')
-rw-r--r--numpy/lib/src/_compiled_base.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index c31ee5cd8..d389b7f8e 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -7,6 +7,10 @@
#include "numpy/ufuncobject.h"
#include "string.h"
+#if (PY_VERSION_HEX < 0x02060000)
+#define Py_TYPE(o) (((PyObject*)(o))->ob_type)
+#endif
+
static npy_intp
incr_slot_(double x, double *bins, npy_intp lbins)
{
@@ -670,7 +674,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 +699,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;