Oh, I see. Okay,now I agree both that it was likely fine, *and* that it'd
be slightly better to add an #if to be certain. :-)

In numpy/core/src/multiarray/common.c:

> @@ -629,7 +629,14 @@
>      ptr = (npy_intp) PyArray_DATA(ap);
>      aligned = (ptr % alignment) == 0;
>      for (i = 0; i < PyArray_NDIM(ap); i++) {
> -        aligned &= ((PyArray_STRIDES(ap)[i] % alignment) == 0);
> +        if (PyArray_DIM(ap, i) > 1) {
> +            /* if shape[i] == 1, the stride is never used */
> +            aligned &= ((PyArray_STRIDES(ap)[i] % alignment) == 0);
> +        }
> +        else if (PyArray_DIM(ap, i) == 0) {
> +            /* 0-sized array is always aligned */
> +            return 1;
> +        }

This changes the aligned flag, and I thought there is no reason not to
change it generally in master. Unless someone double checks the numpy
buffer and then chokes on it (similar to cythons contiguous checks right
now), so if that is a danger, it should get an #if... Ah well... it would
occur very rarely if at all, but putting the #if doesn't hurt I guess.

—
Reply to this email directly or view it on
GitHub<https://github.com/numpy/numpy/pull/3162/files#r3497137>
.