@@ -488,8 +488,6 @@ impl ExecutingFrame<'_> {
488
488
extend_arg : & mut bool ,
489
489
vm : & VirtualMachine ,
490
490
) -> FrameResult {
491
- vm. check_signals ( ) ?;
492
-
493
491
flame_guard ! ( format!(
494
492
"Frame::execute_instruction({})" ,
495
493
instruction. display( arg, & self . code. code) . to_string( )
@@ -807,6 +805,7 @@ impl ExecutingFrame<'_> {
807
805
self . unwind_blocks ( vm, UnwindReason :: Returning { value } )
808
806
}
809
807
bytecode:: Instruction :: YieldValue => {
808
+ vm. check_signals ( ) ?;
810
809
let value = self . pop_value ( ) ;
811
810
let value = if self . code . flags . contains ( bytecode:: CodeFlags :: IS_COROUTINE ) {
812
811
PyAsyncGenWrappedValue ( value) . into_pyobject ( vm)
@@ -815,7 +814,10 @@ impl ExecutingFrame<'_> {
815
814
} ;
816
815
Ok ( Some ( ExecutionResult :: Yield ( value) ) )
817
816
}
818
- bytecode:: Instruction :: YieldFrom => self . execute_yield_from ( vm) ,
817
+ bytecode:: Instruction :: YieldFrom => {
818
+ vm. check_signals ( ) ?;
819
+ self . execute_yield_from ( vm)
820
+ }
819
821
bytecode:: Instruction :: SetupAnnotation => self . setup_annotations ( vm) ,
820
822
bytecode:: Instruction :: SetupLoop => {
821
823
self . push_block ( BlockType :: Loop ) ;
@@ -942,6 +944,7 @@ impl ExecutingFrame<'_> {
942
944
Ok ( None )
943
945
}
944
946
bytecode:: Instruction :: WithCleanupFinish => {
947
+ vm. check_signals ( ) ?;
945
948
let block = self . pop_block ( ) ;
946
949
let ( reason, prev_exc) = match block. typ {
947
950
BlockType :: FinallyHandler { reason, prev_exc } => ( reason, prev_exc) ,
@@ -961,6 +964,7 @@ impl ExecutingFrame<'_> {
961
964
}
962
965
}
963
966
bytecode:: Instruction :: PopBlock => {
967
+ vm. check_signals ( ) ?;
964
968
self . pop_block ( ) ;
965
969
Ok ( None )
966
970
}
@@ -1042,6 +1046,7 @@ impl ExecutingFrame<'_> {
1042
1046
Ok ( None )
1043
1047
}
1044
1048
bytecode:: Instruction :: EndAsyncFor => {
1049
+ vm. check_signals ( ) ?;
1045
1050
let exc = self . pop_value ( ) ;
1046
1051
let except_block = self . pop_block ( ) ; // pushed by TryExcept unwind
1047
1052
debug_assert_eq ! ( except_block. level, self . state. stack. len( ) ) ;
@@ -1097,11 +1102,16 @@ impl ExecutingFrame<'_> {
1097
1102
self . execute_method_call ( args, vm)
1098
1103
}
1099
1104
bytecode:: Instruction :: Jump { target } => {
1105
+ vm. check_signals ( ) ?;
1100
1106
self . jump ( target. get ( arg) ) ;
1101
1107
Ok ( None )
1102
1108
}
1103
- bytecode:: Instruction :: JumpIfTrue { target } => self . jump_if ( vm, target. get ( arg) , true ) ,
1109
+ bytecode:: Instruction :: JumpIfTrue { target } => {
1110
+ vm. check_signals ( ) ?;
1111
+ self . jump_if ( vm, target. get ( arg) , true )
1112
+ }
1104
1113
bytecode:: Instruction :: JumpIfFalse { target } => {
1114
+ vm. check_signals ( ) ?;
1105
1115
self . jump_if ( vm, target. get ( arg) , false )
1106
1116
}
1107
1117
bytecode:: Instruction :: JumpIfTrueOrPop { target } => {
@@ -1111,20 +1121,26 @@ impl ExecutingFrame<'_> {
1111
1121
self . jump_if_or_pop ( vm, target. get ( arg) , false )
1112
1122
}
1113
1123
1114
- bytecode:: Instruction :: Raise { kind } => self . execute_raise ( vm, kind. get ( arg) ) ,
1124
+ bytecode:: Instruction :: Raise { kind } => {
1125
+ vm. check_signals ( ) ?;
1126
+ self . execute_raise ( vm, kind. get ( arg) )
1127
+ }
1115
1128
1116
1129
bytecode:: Instruction :: Break { target } => self . unwind_blocks (
1117
1130
vm,
1118
1131
UnwindReason :: Break {
1119
1132
target : target. get ( arg) ,
1120
1133
} ,
1121
1134
) ,
1122
- bytecode:: Instruction :: Continue { target } => self . unwind_blocks (
1123
- vm,
1124
- UnwindReason :: Continue {
1125
- target : target. get ( arg) ,
1126
- } ,
1127
- ) ,
1135
+ bytecode:: Instruction :: Continue { target } => {
1136
+ vm. check_signals ( ) ?;
1137
+ self . unwind_blocks (
1138
+ vm,
1139
+ UnwindReason :: Continue {
1140
+ target : target. get ( arg) ,
1141
+ } ,
1142
+ )
1143
+ }
1128
1144
bytecode:: Instruction :: PrintExpr => self . print_expr ( vm) ,
1129
1145
bytecode:: Instruction :: LoadBuildClass => {
1130
1146
self . push_value ( vm. builtins . get_attr ( identifier ! ( vm, __build_class__) , vm) ?) ;
0 commit comments