Skip to content

Commit 65240fd

Browse files
committed
sequence accesses should raise IndexError on overflow
1 parent 6502fb2 commit 65240fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ private PythonObjectLibrary getLibrary() {
477477
}
478478

479479
protected final int normalizeIndex(VirtualFrame frame, Object idx, SequenceStorage store) {
480-
int intIdx = getLibrary().asSizeWithState(idx, PArguments.getThreadState(frame));
480+
int intIdx = getLibrary().asSizeWithState(idx, PythonBuiltinClassType.IndexError, PArguments.getThreadState(frame));
481481
if (normalizeIndexNode != null) {
482482
return normalizeIndexNode.execute(intIdx, getStoreProfile().profile(store).length());
483483
}
@@ -492,7 +492,7 @@ protected final int normalizeIndex(@SuppressWarnings("unused") VirtualFrame fram
492492
}
493493

494494
protected final int normalizeIndex(@SuppressWarnings("unused") VirtualFrame frame, long idx, SequenceStorage store) {
495-
int intIdx = getLibrary().asSize(idx);
495+
int intIdx = getLibrary().asSize(idx, PythonBuiltinClassType.IndexError);
496496
if (normalizeIndexNode != null) {
497497
return normalizeIndexNode.execute(intIdx, getStoreProfile().profile(store).length());
498498
}

0 commit comments

Comments
 (0)