Skip to content

Commit f2ea10f

Browse files
msimacektomasstupka
authored andcommitted
Fix handling slices with start==None
1 parent d2232b3 commit f2ea10f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/slice/PIntSlice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public final int getIntStep() {
8888
return step;
8989
}
9090

91-
public boolean isStartIsNone() {
91+
public boolean isStartNone() {
9292
return startIsNone;
9393
}
9494

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/subscript/SliceLiteralNode.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ public abstract static class SliceUnpack extends PNodeWithContext {
284284

285285
@Specialization
286286
SliceInfo doSliceInt(PIntSlice slice) {
287-
return new SliceInfo(slice.getIntStart(), slice.getIntStop(), slice.getIntStep());
287+
int start = slice.getIntStart();
288+
if (slice.isStartNone()) {
289+
start = slice.getIntStep() >= 0 ? 0 : Integer.MAX_VALUE;
290+
}
291+
return new SliceInfo(start, slice.getIntStop(), slice.getIntStep());
288292
}
289293

290294
@Specialization

0 commit comments

Comments
 (0)