Skip to content

Commit

Permalink
C89 compatibility (for windows installation with Python 2.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasibalic committed Jun 8, 2017
1 parent 90554f6 commit 7a490e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arc/arc_c_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,9 @@ static PyObject *NumerovWavefunction(PyObject *self, PyObject *args) {
for (i=totalLength; i<2*totalLength; i++) sol[i]=sol[i]*sol[i];

// return the array as a numpy array (numpy will free it later)
npy_intp dims[2] = {totalLength,totalLength};
PyObject *narray = PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, sol);
dims[0] = totalLength;
dims[0] = totalLength;
narray = PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, sol);
//free(sol); # freeing of solution array should be done from Numpy
// this is the critical line - tell numpy it has to free the data
PyArray_ENABLEFLAGS((PyArrayObject*)narray, NPY_ARRAY_OWNDATA);
Expand Down

0 comments on commit 7a490e0

Please sign in to comment.