Skip to content

Commit 8ababfd

Browse files
committed
get rid of raiseIndexError in builtin base node
1 parent fd8706a commit 8ababfd

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PythonCextBuiltins.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,11 +1952,12 @@ PBytes doLong(long size) {
19521952
}
19531953

19541954
@Specialization(replaces = "doLong")
1955-
PBytes doLongOvf(long size) {
1955+
PBytes doLongOvf(long size,
1956+
@Shared("raiseNode") @Cached PRaiseNode raiseNode) {
19561957
try {
19571958
return doInt(PInt.intValueExact(size));
19581959
} catch (ArithmeticException e) {
1959-
throw raiseIndexError();
1960+
throw raiseNode.raiseIndexError(IndexError, size);
19601961
}
19611962
}
19621963

@@ -1966,11 +1967,12 @@ PBytes doPInt(PInt size) {
19661967
}
19671968

19681969
@Specialization(replaces = "doPInt")
1969-
PBytes doPIntOvf(PInt size) {
1970+
PBytes doPIntOvf(PInt size,
1971+
@Shared("raiseNode") @Cached PRaiseNode raiseNode) {
19701972
try {
19711973
return doInt(size.intValueExact());
19721974
} catch (ArithmeticException e) {
1973-
throw raiseIndexError();
1975+
throw raiseNode.raiseIndexError(IndexError, size);
19741976
}
19751977
}
19761978
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ protected Object doIt(Object object,
737737
abstract static class IndexNode extends PythonUnaryBuiltinNode {
738738
@Specialization(limit = "3")
739739
protected Object doIt(Object object,
740+
@Cached PRaiseNode raiseNode,
740741
@CachedLibrary("object") InteropLibrary lib) {
741742
if (lib.isBoolean(object)) {
742743
try {
@@ -752,7 +753,7 @@ protected Object doIt(Object object,
752753
throw new IllegalStateException("foreign value claims it fits into index-sized int, but doesn't");
753754
}
754755
}
755-
throw raiseIndexError();
756+
throw raiseNode.raiseIntegerInterpretationError(object);
756757
}
757758
}
758759

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/function/PythonBuiltinBaseNode.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ public PException raise(LazyPythonClass exceptionType) {
166166
return getRaiseNode().raise(exceptionType);
167167
}
168168

169-
public final PException raiseIndexError() {
170-
return getRaiseNode().raiseIndexError();
171-
}
172-
173169
public final PException raise(PythonBuiltinClassType type, PBaseException cause, String format, Object... arguments) {
174170
return getRaiseNode().raise(type, cause, format, arguments);
175171
}

0 commit comments

Comments
 (0)