File tree 2 files changed +8
-10
lines changed
2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -230,17 +230,15 @@ cdef class IndexEngine:
230
230
def __sizeof__(self ) -> int:
231
231
return self.sizeof()
232
232
233
- cpdef _update_from_other (self , IndexEngine other , reverse: bool ):
233
+ cpdef _update_from_sliced (self , IndexEngine other , reverse: bool ):
234
234
self .unique = other.unique
235
235
self .need_unique_check = other.need_unique_check
236
- self .need_monotonic_check = other.need_monotonic_check
237
- if reverse and not self .need_monotonic_check:
238
- # the slice reverses the index
239
- self .monotonic_inc = other.monotonic_dec
240
- self .monotonic_dec = other.monotonic_inc
241
- else :
242
- self .monotonic_inc = other.monotonic_inc
243
- self .monotonic_dec = other.monotonic_dec
236
+ if not other.need_monotonic_check and (
237
+ other.is_monotonic_increasing or other.is_monotonic_decreasing):
238
+ self .need_monotonic_check = other.need_monotonic_check
239
+ # reverse=True means the index has been reversed
240
+ self .monotonic_inc = other.monotonic_dec if reverse else other.monotonic_inc
241
+ self .monotonic_dec = other.monotonic_inc if reverse else other.monotonic_dec
244
242
245
243
@property
246
244
def is_unique (self ) -> bool:
Original file line number Diff line number Diff line change @@ -5182,7 +5182,7 @@ def _getitem_slice(self: _IndexT, slobj: slice) -> _IndexT:
5182
5182
result = type (self )._simple_new (res , name = self ._name )
5183
5183
if isinstance (result ._engine , libindex .IndexEngine ): # may also be IntervalTree
5184
5184
reverse = slobj .step is not None and slobj .step < 0
5185
- result ._engine ._update_from_other (self ._engine , reverse = reverse )
5185
+ result ._engine ._update_from_sliced (self ._engine , reverse = reverse )
5186
5186
5187
5187
return result
5188
5188
You can’t perform that action at this time.
0 commit comments