[Numpy-discussion] Numeric CVS __array_struct__ interface is broken on 64 bit platforms

Andrew Straw strawman at astraw.com
Wed Nov 9 10:33:40 EST 2005


Hi,

A couple bugs have been reported (including mine last night) which
indicate a problem with the following bit of code in
Numerical/Src/arrayobject.c (near line 2200) on 64 bit platforms.  I
think it'll be a lot faster for someone else to fix it, so I'll leave it
at this for now.

    if (strcmp(name, "__array_struct__") == 0) {
        PyArrayInterface *inter;
        inter = (PyArrayInterface *)malloc(sizeof(PyArrayInterface));
        inter->version = 2;
        inter->nd = self->nd;
        if ((inter->nd == 0) || (sizeof(int) == sizeof(Py_intptr_t))) {
            inter->shape = (Py_intptr_t *)self->dimensions;
            inter->strides = (Py_intptr_t *)self->strides;
        }
	else {
	    int i;
	    for (i=0; i<self->nd; i++) {
		inter->shape[i] = self->dimensions[i];
		inter->strides[i] = self->strides[i];
	    }
	}




More information about the NumPy-Discussion mailing list