Skip to content

Commit 8fa2206

Browse files
committed
Remove LazyPythonClass use in ExceptNode
1 parent a4c01b6 commit 8fa2206

File tree

1 file changed

+8
-7
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement

1 file changed

+8
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement/ExceptNode.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes;
3232
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
3333
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
34-
import com.oracle.graal.python.builtins.objects.type.LazyPythonClass;
3534
import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass;
3635
import com.oracle.graal.python.nodes.ErrorMessages;
3736
import com.oracle.graal.python.nodes.PGuards;
@@ -175,9 +174,10 @@ boolean isPythonExceptionClassCached(@SuppressWarnings("unused") PythonBuiltinCl
175174
return isExceptionType;
176175
}
177176

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) {
181181
return isSubtype.execute(frame, type, PythonBuiltinClassType.PBaseException);
182182
}
183183

@@ -253,12 +253,13 @@ boolean doNotMatchPython(VirtualFrame frame, @SuppressWarnings("unused") PExcept
253253
return false;
254254
}
255255

256-
@Specialization(guards = {"emulateJython(language)", "context.getEnv().isHostException(e)"})
256+
@Specialization(guards = {"lib.isLazyPythonClass(clause)", "emulateJython(language)", "context.getEnv().isHostException(e)"})
257257
@SuppressWarnings("unused")
258-
boolean doNotMatchJava(VirtualFrame frame, @SuppressWarnings("unused") Throwable e, LazyPythonClass clause,
258+
boolean doNotMatchJava(VirtualFrame frame, @SuppressWarnings("unused") Throwable e, Object clause,
259259
@CachedLanguage PythonLanguage language,
260260
@CachedContext(PythonLanguage.class) PythonContext context,
261-
@Cached ValidExceptionNode isValidException) {
261+
@Cached ValidExceptionNode isValidException,
262+
@CachedLibrary(limit = "2") PythonObjectLibrary lib) {
262263
raiseIfNoException(frame, clause, isValidException);
263264
return false;
264265
}

0 commit comments

Comments
 (0)