This would be more concise if it was
```
if (PyArray_CanCastTypeTo(dtype, out_dt, NPY_SAFE_CASTING) == 0) {
    do the error thing;
    goto fail;
}
```