Commits

Anonymous committed 01f878a

use NULL instead of descr. in multiarraymodule.c, it says "/* steals a reference to typedescr -- can be NULL*/"

  • Participants
  • Parent commits 3373cc2

Comments (0)

Files changed (1)

ascarray/ascarraymodule.c

   int nd;
   PyObject *o1;
   npy_intp dims[3];
-  PyArray_Descr *descr;
 
   if (PyArg_ParseTuple(args, "O:print_array", &o1) < 0) {
     PyErr_SetString( PyExc_TypeError, "bad arguments");
   case 1:
     if (PyArray_ISFLOAT(o1)){
       double *ptr;
-      descr = PyArray_DescrFromType(NPY_DOUBLE);
-      Py_INCREF(descr);
-      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, descr);
-      Py_DECREF(descr);
+      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, NULL);
       print_array_d1d(ptr, dims[0], 0);
       PyArray_Free(o1, (void *)ptr);
     }else if (PyArray_ISINTEGER(o1)){
   case 2:
     if (PyArray_ISFLOAT(o1)){
       double **ptr;
-      descr = PyArray_DescrFromType(NPY_DOUBLE);
-      Py_INCREF(descr);
-      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, descr);
-      Py_DECREF(descr);
+      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, NULL);
       print_array_d2d(ptr, dims[0], dims[1], 0);
       PyArray_Free(o1, (void *)ptr);
     }else if (PyArray_ISINTEGER(o1)){
     if (PyArray_ISFLOAT(o1)){
       double ***ptr;
       PyObject *tmp=o1;
-      descr = PyArray_DescrFromType(NPY_DOUBLE);
       Py_INCREF(tmp);
-      Py_INCREF(descr);
-      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, descr);
+      PyArray_AsCArray(&o1, (void *)&ptr, dims, nd, NULL);
       print_array_d3d(ptr, dims[0], dims[1], dims[2], 0);
       PyArray_Free(o1, (void *)ptr);
-      Py_DECREF(descr);
       Py_DECREF(tmp);
     }else if (PyArray_ISINTEGER(o1)){
       return NULL;