@@ -1475,7 +1475,7 @@ def slices_eval( # noqa: C901
14751475 # Get the starts and stops for the slice
14761476 starts = [s .start if s .start is not None else 0 for s in cslice ]
14771477 stops = [s .stop if s .stop is not None else sh for s , sh in zip (cslice , cslice_shape , strict = True )]
1478- stepper = tuple ( slice ( None , None , s .step ) for s in cslice )
1478+ unit_steps = np . all ([ s .step == 1 for s in cslice ] )
14791479
14801480 # Get the slice of each operand
14811481 for key , value in operands .items ():
@@ -1495,9 +1495,9 @@ def slices_eval( # noqa: C901
14951495 key in chunk_operands
14961496 and cslice_shape == chunk_operands [key ].shape
14971497 and isinstance (value , blosc2 .NDArray )
1498+ and unit_steps
14981499 ):
14991500 value .get_slice_numpy (chunk_operands [key ], (starts , stops ))
1500- chunk_operands [key ] = chunk_operands [key ][stepper ]
15011501 continue
15021502
15031503 chunk_operands [key ] = value [cslice ]
@@ -1871,8 +1871,8 @@ def reduce_slices( # noqa: C901
18711871 # get intersection of chunk and target
18721872 cslice = step_handler (cslice , _slice )
18731873 chunks_ = tuple (s .stop - s .start for s in cslice )
1874- fast_path = False if any (( s .step != 1 or s . step is not None ) for s in cslice ) else fast_path
1875- if _slice == () and fast_path :
1874+ unit_steps = np . all ([ s .step == 1 for s in cslice ])
1875+ if _slice == () and fast_path and unit_steps :
18761876 # Fast path
18771877 full_chunk = chunks_ == chunks
18781878 fill_chunk_operands (
@@ -1882,7 +1882,6 @@ def reduce_slices( # noqa: C901
18821882 # Get the starts and stops for the slice
18831883 starts = [s .start if s .start is not None else 0 for s in cslice ]
18841884 stops = [s .stop if s .stop is not None else sh for s , sh in zip (cslice , chunks_ , strict = True )]
1885- stepper = tuple (slice (None , None , s .step ) for s in cslice )
18861885 # Get the slice of each operand
18871886 for key , value in operands .items ():
18881887 if np .isscalar (value ):
@@ -1901,9 +1900,9 @@ def reduce_slices( # noqa: C901
19011900 key in chunk_operands
19021901 and chunks_ == chunk_operands [key ].shape
19031902 and isinstance (value , blosc2 .NDArray )
1903+ and unit_steps
19041904 ):
19051905 value .get_slice_numpy (chunk_operands [key ], (starts , stops ))
1906- chunk_operands [key ] = chunk_operands [key ][stepper ]
19071906 continue
19081907 chunk_operands [key ] = value [cslice ]
19091908
0 commit comments