Skip to content

Commit ebdb454

Browse files
committed
Fix NPE on interop exceptions
1 parent 7e4cc96 commit ebdb454

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode/PBytecodeRootNode.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,7 +2278,11 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
22782278
CompilerAsserts.partialEvaluationConstant(targetIndex);
22792279
chainPythonExceptions(virtualFrame, mutableData, pe);
22802280
if (targetIndex == -1) {
2281-
throw reraiseUnhandledException(virtualFrame, localFrame, initialStackTop, isGeneratorOrCoroutine, mutableData, bciSlot, beginBci, pe, tracingEnabled, profilingEnabled);
2281+
reraiseUnhandledException(virtualFrame, localFrame, initialStackTop, isGeneratorOrCoroutine, mutableData, bciSlot, beginBci, pe, tracingEnabled, profilingEnabled);
2282+
if (pe != null) {
2283+
throw pe;
2284+
}
2285+
throw e;
22822286
}
22832287
if (pe != null) {
22842288
pe.setCatchingFrameReference(virtualFrame, this, beginBci);
@@ -3042,7 +3046,7 @@ private void unboxVariables(Frame localFrame) {
30423046
}
30433047

30443048
@InliningCutoff
3045-
private PException reraiseUnhandledException(VirtualFrame virtualFrame, Frame localFrame, int initialStackTop, boolean isGeneratorOrCoroutine, MutableLoopData mutableData, int bciSlot,
3049+
private void reraiseUnhandledException(VirtualFrame virtualFrame, Frame localFrame, int initialStackTop, boolean isGeneratorOrCoroutine, MutableLoopData mutableData, int bciSlot,
30463050
int beginBci, PException pe, boolean tracingEnabled, boolean profilingEnabled) {
30473051
// For tracebacks
30483052
setCurrentBci(virtualFrame, bciSlot, beginBci);
@@ -3059,7 +3063,6 @@ private PException reraiseUnhandledException(VirtualFrame virtualFrame, Frame lo
30593063
LoopNode.reportLoopCount(this, mutableData.loopCount);
30603064
}
30613065
traceOrProfileReturn(virtualFrame, mutableData, PNone.NONE, tracingEnabled, profilingEnabled);
3062-
throw pe;
30633066
}
30643067

30653068
@InliningCutoff

0 commit comments

Comments
 (0)