Skip to content

Commit efe89a2

Browse files
committed
Add deopt to encoding error handlers
1 parent da63807 commit efe89a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public byte[] doRaise(TruffleEncoder encoder, @SuppressWarnings("unused") String
128128
if (exception instanceof PBaseException) {
129129
throw raiseNode.raiseExceptionObject((PBaseException) exception, pythonLanguage);
130130
} else {
131+
// Shouldn't happen unless the user manually replaces the method, which is really
132+
// unexpected and shouldn't be permitted at all, but currently it is
133+
CompilerDirectives.transferToInterpreterAndInvalidate();
131134
throw raiseNode.raise(TypeError, ErrorMessages.SHOULD_HAVE_RETURNED_EXCEPTION, UnicodeEncodeError, exception);
132135
}
133136
}
@@ -153,6 +156,9 @@ public byte[] doRaise(TruffleDecoder encoder, @SuppressWarnings("unused") String
153156
if (exception instanceof PBaseException) {
154157
throw raiseNode.raiseExceptionObject((PBaseException) exception, pythonLanguage);
155158
} else {
159+
// Shouldn't happen unless the user manually replaces the method, which is really
160+
// unexpected and shouldn't be permitted at all, but currently it is
161+
CompilerDirectives.transferToInterpreterAndInvalidate();
156162
throw raiseNode.raise(TypeError, ErrorMessages.SHOULD_HAVE_RETURNED_EXCEPTION, UnicodeDecodeError, exception);
157163
}
158164
}

0 commit comments

Comments
 (0)