Commits

Anonymous committed 74fe796

try PyArray_New

  • Participants
  • Parent commits 52da926

Comments (0)

Files changed (1)

File carraywrap/carraywrapmodule.c

 static int
 CArrayWrap_traverse(CArrayWrap *self, visitproc visit, void *arg)
 {
+#ifdef CARRAYWRAP_VERBOSE
+  printf("'%s' called\n", __func__);
+#endif
   Py_VISIT(self->nparray);
   return 0;
 }
 static int
 CArrayWrap_clear(CArrayWrap *self)
 {
+#ifdef CARRAYWRAP_VERBOSE
+  printf("'%s' called\n", __func__);
+#endif
   Py_CLEAR(self->nparray);
   return 0;
 }
 
   tmp = self->nparray;
   self->nparray =
-    PyArray_SimpleNewFromData( self->ndim, self->dims, NPY_LONG,
-			       (void *)self->data );
+    PyArray_New(&PyArray_Type, self->ndim, self->dims, NPY_LONG, NULL,
+    		(void *)self->data, 0, NPY_CARRAY, (PyObject *)self);
+    /* PyArray_SimpleNewFromData( self->ndim, self->dims, NPY_LONG, */
+    /* 			       (void *)self->data ); */
   if (self->nparray == NULL){
     PyErr_SetString( PyExc_RuntimeError, "PyArray_SimpleNewFromData fails");
     goto fail;
   }
-  Py_INCREF(self->nparray);
+  /* Py_INCREF(self->nparray); */
   Py_XDECREF(tmp);
 
 /* #define CARRAYWRAP_TEST_OWNDATA_FAIL */