@@ -3409,7 +3409,6 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y)
3409
3409
PyArray_Descr * op_dt [4 ] = {common_dt , PyArray_DescrFromType (NPY_BOOL ),
3410
3410
common_dt , common_dt };
3411
3411
NpyIter * iter ;
3412
- int needs_api ;
3413
3412
NPY_BEGIN_THREADS_DEF ;
3414
3413
3415
3414
if (common_dt == NULL || op_dt [1 ] == NULL ) {
@@ -3426,23 +3425,19 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y)
3426
3425
goto fail ;
3427
3426
}
3428
3427
3429
- needs_api = NpyIter_IterationNeedsAPI (iter );
3430
-
3431
3428
/* Get the result from the iterator object array */
3432
3429
ret = (PyObject * )NpyIter_GetOperandArray (iter )[0 ];
3433
3430
3434
3431
npy_intp itemsize = common_dt -> elsize ;
3435
3432
3436
- int swap = PyDataType_ISBYTESWAPPED (common_dt );
3437
- int native = (swap == 0 ) && !needs_api ;
3433
+ int has_ref = PyDataType_REFCHK (common_dt );
3438
3434
3439
3435
NPY_ARRAYMETHOD_FLAGS transfer_flags = 0 ;
3440
3436
3441
3437
npy_intp transfer_strides [2 ] = {itemsize , itemsize };
3442
-
3443
3438
npy_intp one = 1 ;
3444
3439
3445
- if (! native || ((itemsize != 16 ) && (itemsize != 8 ) && (itemsize != 4 ) &&
3440
+ if (has_ref || ((itemsize != 16 ) && (itemsize != 8 ) && (itemsize != 4 ) &&
3446
3441
(itemsize != 2 ) && (itemsize != 1 ))) {
3447
3442
// The iterator has NPY_ITER_ALIGNED flag so no need to check alignment
3448
3443
// of the input arrays.
@@ -3483,19 +3478,19 @@ PyArray_Where(PyObject *condition, PyObject *x, PyObject *y)
3483
3478
npy_intp ystride = strides [3 ];
3484
3479
3485
3480
/* constant sizes so compiler replaces memcpy */
3486
- if (native && itemsize == 16 ) {
3481
+ if (! has_ref && itemsize == 16 ) {
3487
3482
INNER_WHERE_LOOP (16 );
3488
3483
}
3489
- else if (native && itemsize == 8 ) {
3484
+ else if (! has_ref && itemsize == 8 ) {
3490
3485
INNER_WHERE_LOOP (8 );
3491
3486
}
3492
- else if (native && itemsize == 4 ) {
3487
+ else if (! has_ref && itemsize == 4 ) {
3493
3488
INNER_WHERE_LOOP (4 );
3494
3489
}
3495
- else if (native && itemsize == 2 ) {
3490
+ else if (! has_ref && itemsize == 2 ) {
3496
3491
INNER_WHERE_LOOP (2 );
3497
3492
}
3498
- else if (native && itemsize == 1 ) {
3493
+ else if (! has_ref && itemsize == 1 ) {
3499
3494
INNER_WHERE_LOOP (1 );
3500
3495
}
3501
3496
else {
0 commit comments