|
31 | 31 | import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes;
|
32 | 32 | import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
|
33 | 33 | import com.oracle.graal.python.builtins.objects.tuple.PTuple;
|
34 |
| -import com.oracle.graal.python.builtins.objects.type.LazyPythonClass; |
35 | 34 | import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass;
|
36 | 35 | import com.oracle.graal.python.nodes.ErrorMessages;
|
37 | 36 | import com.oracle.graal.python.nodes.PGuards;
|
@@ -175,9 +174,10 @@ boolean isPythonExceptionClassCached(@SuppressWarnings("unused") PythonBuiltinCl
|
175 | 174 | return isExceptionType;
|
176 | 175 | }
|
177 | 176 |
|
178 |
| - @Specialization(replaces = {"isPythonExceptionTypeCached", "isPythonExceptionClassCached"}) |
179 |
| - boolean isPythonException(VirtualFrame frame, LazyPythonClass type, |
180 |
| - @Cached IsSubtypeNode isSubtype) { |
| 177 | + @Specialization(guards = "lib.isLazyPythonClass(type)", replaces = {"isPythonExceptionTypeCached", "isPythonExceptionClassCached"}) |
| 178 | + boolean isPythonException(VirtualFrame frame, Object type, |
| 179 | + @Cached IsSubtypeNode isSubtype, |
| 180 | + @SuppressWarnings("unused") @CachedLibrary(limit = "2") PythonObjectLibrary lib) { |
181 | 181 | return isSubtype.execute(frame, type, PythonBuiltinClassType.PBaseException);
|
182 | 182 | }
|
183 | 183 |
|
@@ -253,12 +253,13 @@ boolean doNotMatchPython(VirtualFrame frame, @SuppressWarnings("unused") PExcept
|
253 | 253 | return false;
|
254 | 254 | }
|
255 | 255 |
|
256 |
| - @Specialization(guards = {"emulateJython(language)", "context.getEnv().isHostException(e)"}) |
| 256 | + @Specialization(guards = {"lib.isLazyPythonClass(clause)", "emulateJython(language)", "context.getEnv().isHostException(e)"}) |
257 | 257 | @SuppressWarnings("unused")
|
258 |
| - boolean doNotMatchJava(VirtualFrame frame, @SuppressWarnings("unused") Throwable e, LazyPythonClass clause, |
| 258 | + boolean doNotMatchJava(VirtualFrame frame, @SuppressWarnings("unused") Throwable e, Object clause, |
259 | 259 | @CachedLanguage PythonLanguage language,
|
260 | 260 | @CachedContext(PythonLanguage.class) PythonContext context,
|
261 |
| - @Cached ValidExceptionNode isValidException) { |
| 261 | + @Cached ValidExceptionNode isValidException, |
| 262 | + @CachedLibrary(limit = "2") PythonObjectLibrary lib) { |
262 | 263 | raiseIfNoException(frame, clause, isValidException);
|
263 | 264 | return false;
|
264 | 265 | }
|
|
0 commit comments