[Numpy-discussion] slice question and bug

clee at spiralis.merseine.nu clee at spiralis.merseine.nu
Mon Apr 1 09:06:59 EST 2002

I'm trying to track down a segv when I do the B[:] operation on an
array, "B", a that I've built in as a view on external data.  During
the process I ran into the following code (Numeric-21.0):

/* {%c++%} */
     extern int PyArray_Free(PyObject *op, char *ptr) {
	 PyArrayObject *ap = (PyArrayObject *)op;
	 int i, n;

	 if (ap->nd > 2) return -1;
	 if (ap->nd == 3) {
	     n = ap->dimensions[0];
	     for (i=0; i<n; i++) {
		 free(((char **)ptr)[i]);
	 if (ap->nd >= 2) {
	 return 0;
/* {%c++%} */

The multiple, incompatible tests of ap->nd are the problem.  


More information about the NumPy-Discussion mailing list