59
59
import com .oracle .graal .python .nodes .PNodeWithContext ;
60
60
import com .oracle .graal .python .nodes .truffle .PythonTypes ;
61
61
import com .oracle .graal .python .runtime .exception .PException ;
62
- import com .oracle .truffle .api .CompilerDirectives ;
63
62
import com .oracle .truffle .api .dsl .Bind ;
64
63
import com .oracle .truffle .api .dsl .Cached ;
65
64
import com .oracle .truffle .api .dsl .Fallback ;
68
67
import com .oracle .truffle .api .dsl .Specialization ;
69
68
import com .oracle .truffle .api .dsl .TypeSystemReference ;
70
69
import com .oracle .truffle .api .exception .AbstractTruffleException ;
71
- import com .oracle .truffle .api .interop .ExceptionType ;
72
- import com .oracle .truffle .api .interop .InteropLibrary ;
73
- import com .oracle .truffle .api .interop .UnsupportedMessageException ;
74
70
import com .oracle .truffle .api .library .CachedLibrary ;
75
71
import com .oracle .truffle .api .object .DynamicObjectLibrary ;
76
72
import com .oracle .truffle .api .object .Shape ;
@@ -197,9 +193,8 @@ static Object getNativeVoidPtr(@SuppressWarnings("unused") PythonNativeVoidPtr o
197
193
return PythonBuiltinClassType .PInt ;
198
194
}
199
195
200
- @ Specialization (guards = "isForeignRuntimeException(object, lib)" )
201
- static Object getTruffleException (@ SuppressWarnings ("unused" ) AbstractTruffleException object ,
202
- @ SuppressWarnings ("unused" ) @ CachedLibrary (limit = "3" ) InteropLibrary lib ) {
196
+ @ Specialization
197
+ static Object getTruffleException (@ SuppressWarnings ("unused" ) AbstractTruffleException object ) {
203
198
/*
204
199
* Special case: if Python code asks for the class of a foreign exception, we return a
205
200
* Python type that inherits from BaseException. We do this because Python users usually
@@ -217,12 +212,4 @@ static Object getForeign(@SuppressWarnings("unused") Object object) {
217
212
protected static boolean hasInitialClass (Shape shape ) {
218
213
return (shape .getFlags () & PythonObject .CLASS_CHANGED_FLAG ) == 0 ;
219
214
}
220
-
221
- protected static boolean isForeignRuntimeException (AbstractTruffleException e , InteropLibrary lib ) {
222
- try {
223
- return lib .isException (e ) && lib .getExceptionType (e ) == ExceptionType .RUNTIME_ERROR ;
224
- } catch (UnsupportedMessageException ex ) {
225
- throw CompilerDirectives .shouldNotReachHere (ex );
226
- }
227
- }
228
215
}
0 commit comments