From ab9be922f0dde0c41c33f22bbb3042dc27af2220 Mon Sep 17 00:00:00 2001 From: rgommers Date: Wed, 9 Mar 2011 10:55:40 +0800 Subject: BUG: fix compilation with MSVC 2008. Thanks to Christoph Gohlke. --- numpy/core/src/multiarray/arraytypes.c.src | 2 ++ numpy/core/src/multiarray/ctors.c | 3 ++- numpy/core/src/multiarray/einsum.c.src | 2 +- numpy/core/src/multiarray/item_selection.c | 2 +- numpy/core/src/multiarray/new_iterator.c.src | 2 +- numpy/core/src/umath/ufunc_object.c | 18 ++++++++++++------ 6 files changed, 19 insertions(+), 10 deletions(-) (limited to 'numpy') diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index dee492482..3f2a9ac71 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -1593,6 +1593,7 @@ static void } /* convert from Python object to needed one */ #if @convert@ + { PyObject *new, *args; /* call out to the Python builtin given by convstr */ args = Py_BuildValue("(N)", temp); @@ -1608,6 +1609,7 @@ static void if (temp == NULL) { return; } + } #endif /* @convert@ */ if (@to@_setitem(temp,(char *)op, aop)) { Py_DECREF(temp); diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 4fb6bc781..36e1cb467 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -2395,7 +2395,6 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src, PyArray_StridedTransferFn *stransfer = NULL; void *transferdata = NULL; NpyIter *dst_iter, *src_iter; - NPY_BEGIN_THREADS_DEF; NpyIter_IterNext_Fn dst_iternext, src_iternext; char **dst_dataptr, **src_dataptr; @@ -2408,6 +2407,8 @@ PyArray_CopyAnyIntoOrdered(PyArrayObject *dst, PyArrayObject *src, npy_intp dst_size, src_size; int needs_api; + NPY_BEGIN_THREADS_DEF; + if (!PyArray_ISWRITEABLE(dst)) { PyErr_SetString(PyExc_RuntimeError, "cannot write to array"); diff --git a/numpy/core/src/multiarray/einsum.c.src b/numpy/core/src/multiarray/einsum.c.src index 9200c7cdf..5233ea524 100644 --- a/numpy/core/src/multiarray/einsum.c.src +++ b/numpy/core/src/multiarray/einsum.c.src @@ -50,7 +50,7 @@ #if NPY_EINSUM_DBG_TRACING #define NPY_EINSUM_DBG_PRINTF(...) printf(__VA_ARGS__) #else -#define NPY_EINSUM_DBG_PRINTF(...) +#define NPY_EINSUM_DBG_PRINTF #endif /**********************************************/ diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index db379e566..022f3d9c0 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -1880,8 +1880,8 @@ finish: } else { for (i = 0; i < ndim; ++i) { - stride = ndim*NPY_SIZEOF_INTP; PyArrayObject *view; + stride = ndim*NPY_SIZEOF_INTP; view = (PyArrayObject *)PyArray_New(Py_TYPE(self), 1, &nonzero_count, diff --git a/numpy/core/src/multiarray/new_iterator.c.src b/numpy/core/src/multiarray/new_iterator.c.src index 1208e5d3c..3d8566f05 100644 --- a/numpy/core/src/multiarray/new_iterator.c.src +++ b/numpy/core/src/multiarray/new_iterator.c.src @@ -50,7 +50,7 @@ #if NPY_IT_DBG_TRACING #define NPY_IT_DBG_PRINTF(...) printf(__VA_ARGS__) #else -#define NPY_IT_DBG_PRINTF(...) +#define NPY_IT_DBG_PRINTF #endif /**********************************************/ diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index e2e999b5b..07a308e66 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -47,7 +47,7 @@ #if NPY_UF_DBG_TRACING #define NPY_UF_DBG_PRINTF(...) printf(__VA_ARGS__) #else -#define NPY_UF_DBG_PRINTF(...) +#define NPY_UF_DBG_PRINTF #endif /**********************************************/ @@ -1762,7 +1762,6 @@ iterator_loop(PyUFuncObject *self, NpyIter *iter; char *baseptrs[NPY_MAXARGS]; int needs_api; - NPY_BEGIN_THREADS_DEF; NpyIter_IterNext_Fn iternext; char **dataptr; @@ -1771,6 +1770,8 @@ iterator_loop(PyUFuncObject *self, PyArrayObject **op_it; + NPY_BEGIN_THREADS_DEF; + /* Set up the flags */ for (i = 0; i < nin; ++i) { op_flags[i] = NPY_ITER_READONLY| @@ -2792,7 +2793,6 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr, npy_uint32 op_flags[2]; int i, idim, ndim, otype_final; int needs_api, need_outer_iterator; - NPY_BEGIN_THREADS_DEF; NpyIter *iter = NULL, *iter_inner = NULL; @@ -2806,6 +2806,8 @@ PyUFunc_ReductionOp(PyUFuncObject *self, PyArrayObject *arr, int buffersize = 0, errormask = 0; PyObject *errobj = NULL; + NPY_BEGIN_THREADS_DEF; + NPY_UF_DBG_PRINTF("\nEvaluating ufunc %s.%s\n", ufunc_name, opname); #if 0 @@ -3424,7 +3426,6 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, npy_uint32 op_flags[3]; int i, idim, ndim, otype_final; int needs_api, need_outer_iterator; - NPY_BEGIN_THREADS_DEF; NpyIter *iter = NULL; @@ -3442,6 +3443,8 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, int buffersize = 0, errormask = 0; PyObject *errobj = NULL; + NPY_BEGIN_THREADS_DEF; + reduceat_ind = (npy_intp *)PyArray_DATA(ind); ind_size = PyArray_DIM(ind, 0); red_axis_size = PyArray_DIM(arr, axis); @@ -3599,6 +3602,8 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, NpyIter_IterNext_Fn iternext; char **dataptr; + npy_intp count_m1; + npy_intp stride0, stride1; npy_intp *stride; npy_intp *count_ptr; npy_intp stride0_ind = PyArray_STRIDE(op[0], axis); @@ -3616,8 +3621,9 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind, /* Execute the loop with just the outer iterator */ - npy_intp count_m1 = PyArray_DIM(op[1], axis)-1; - npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis); + count_m1 = PyArray_DIM(op[1], axis)-1; + stride0 = 0; + stride1 = PyArray_STRIDE(op[1], axis); NPY_UF_DBG_PRINTF("UFunc: Reduce loop with just outer iterator\n"); -- cgit v1.2.1