diff --git a/libs/numpy/src/ndarray.cpp b/libs/numpy/src/ndarray.cpp index 30f7213d..286819a2 100644 --- a/libs/numpy/src/ndarray.cpp +++ b/libs/numpy/src/ndarray.cpp @@ -5,6 +5,7 @@ #define BOOST_NUMPY_INTERNAL #include +#include namespace boost { @@ -209,10 +210,10 @@ python::object ndarray::scalarize() const ndarray zeros(python::tuple const & shape, dtype const & dt) { int nd = len(shape); - Py_intptr_t dims[nd]; + boost::scoped_array dims(new Py_intptr_t[nd]); for (int n=0; n(shape[n]); return ndarray(python::detail::new_reference - (PyArray_Zeros(nd, dims, detail::incref_dtype(dt), 0))); + (PyArray_Zeros(nd, dims.get(), detail::incref_dtype(dt), 0))); } ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt) @@ -224,10 +225,10 @@ ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt) ndarray empty(python::tuple const & shape, dtype const & dt) { int nd = len(shape); - Py_intptr_t dims[nd]; + boost::scoped_array dims(new Py_intptr_t[nd]); for (int n=0; n(shape[n]); return ndarray(python::detail::new_reference - (PyArray_Empty(nd, dims, detail::incref_dtype(dt), 0))); + (PyArray_Empty(nd, dims.get(), detail::incref_dtype(dt), 0))); } ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt)