!49957 fix bug: tuple_slice when start, stop, step are unknown

Merge pull request !49957 from Yanzhi_YI/master
This commit is contained in:
i-robot 2023-03-08 08:59:32 +00:00 committed by Gitee
commit 47e14294dd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 6 additions and 0 deletions

View File

@ -137,6 +137,12 @@ def _tuple_getitem_by_slice(data, slice_index):
start = slice_getitem(slice_index, "start") start = slice_getitem(slice_index, "start")
stop = slice_getitem(slice_index, "stop") stop = slice_getitem(slice_index, "stop")
step = slice_getitem(slice_index, "step") step = slice_getitem(slice_index, "step")
if start is None:
start = 0
if step is None:
step = 1
if stop is None:
stop = (2**31-1) if step >= 1 else 0
return sequence_slice(data, start, stop, step) return sequence_slice(data, start, stop, step)
return _tuple_slice(data, slice_index) return _tuple_slice(data, slice_index)