31
31
import com .oracle .graal .python .builtins .PythonBuiltinClassType ;
32
32
import com .oracle .graal .python .builtins .objects .PNone ;
33
33
import com .oracle .graal .python .builtins .objects .exception .PBaseException ;
34
- import com .oracle .graal .python .builtins .objects .type . LazyPythonClass ;
34
+ import com .oracle .graal .python .builtins .objects .object . PythonObjectLibrary ;
35
35
import com .oracle .graal .python .builtins .objects .type .PythonAbstractClass ;
36
36
import com .oracle .graal .python .nodes .ErrorMessages ;
37
37
import com .oracle .graal .python .nodes .PGuards ;
45
45
import com .oracle .truffle .api .dsl .NodeChild ;
46
46
import com .oracle .truffle .api .dsl .Specialization ;
47
47
import com .oracle .truffle .api .frame .VirtualFrame ;
48
+ import com .oracle .truffle .api .library .CachedLibrary ;
48
49
import com .oracle .truffle .api .nodes .Node ;
49
50
import com .oracle .truffle .api .profiles .BranchProfile ;
50
51
import com .oracle .truffle .api .profiles .ConditionProfile ;
@@ -65,12 +66,13 @@ void setCause(@SuppressWarnings("unused") VirtualFrame frame, PBaseException exc
65
66
}
66
67
67
68
// raise * from <class>
68
- @ Specialization
69
- void setCause (@ SuppressWarnings ("unused" ) VirtualFrame frame , PBaseException exception , LazyPythonClass causeClass ,
69
+ @ Specialization ( guards = "lib.isLazyPythonClass(causeClass)" )
70
+ void setCause (@ SuppressWarnings ("unused" ) VirtualFrame frame , PBaseException exception , Object causeClass ,
70
71
@ Cached BranchProfile baseCheckFailedProfile ,
71
72
@ Cached ValidExceptionNode validException ,
72
73
@ Cached CallNode callConstructor ,
73
- @ Cached PRaiseNode raise ) {
74
+ @ Cached PRaiseNode raise ,
75
+ @ SuppressWarnings ("unused" ) @ CachedLibrary (limit = "2" ) PythonObjectLibrary lib ) {
74
76
if (!validException .execute (frame , causeClass )) {
75
77
baseCheckFailedProfile .enter ();
76
78
throw raise .raise (PythonBuiltinClassType .TypeError , ErrorMessages .EXCEPTION_CAUSES_MUST_DERIVE_FROM_BASE_EX );
0 commit comments