Skip to content

Commit c9518e8

Browse files
committed
break(slice): toNimSlice is no longer a cvt; cvt toPySlice from PySlice1
1 parent 80ed786 commit c9518e8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pylib/builtins/pyslice.nim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ func slice*(start, stop: int, step: int): PySlice =
2828

2929
func slice*(stop: int): PySlice1 = slice(0, stop)
3030

31-
converter toNimSlice*(s: PySlice1): Slice[int] =
31+
converter toPySlice*(s: PySlice1): PySlice =
32+
result = PySlice(start: s.start, stop: s.stop, step: 1)
33+
34+
proc toNimSlice*(s: PySlice1): Slice[int] =
35+
assert result.a >= 0 and result.b >= 0
3236
result.b = s.stop - 1
3337
result.a = s.start
3438

0 commit comments

Comments
 (0)