Skip to content

Commit 207aaca

Browse files
committed
compute foreign object size when recalculating the new slice indices.
1 parent e346194 commit 207aaca

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/foreign/AccessForeignItemNodes.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,7 @@ protected int getForeignSize(TruffleObject object, Node getSizeNode, PForeignToP
9595
}
9696

9797
protected SliceInfo materializeSlice(PSlice idxSlice, TruffleObject object, Node getSizeNode, PForeignToPTypeNode foreign2PTypeNode) throws UnsupportedMessageException {
98-
99-
// determine start
100-
boolean isStartMissing = false;
101-
int start = idxSlice.getStart();
102-
if (start == PSlice.MISSING_INDEX) {
103-
start = 0;
104-
isStartMissing = true;
105-
}
106-
107-
// determine stop
108-
int end = idxSlice.getStop();
109-
int foreignSize = -1;
110-
if (end == PSlice.MISSING_INDEX) {
111-
foreignSize = getForeignSize(object, getSizeNode, foreign2PTypeNode);
112-
end = foreignSize;
113-
} else if (isStartMissing) {
114-
foreignSize = getForeignSize(object, getSizeNode, foreign2PTypeNode);
115-
}
116-
117-
// determine length (foreignSize is only required if start or stop is missing)
98+
int foreignSize = getForeignSize(object, getSizeNode, foreign2PTypeNode);
11899
return idxSlice.computeIndices(foreignSize);
119100
}
120101
}

0 commit comments

Comments
 (0)