File tree 1 file changed +13
-5
lines changed 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -708,16 +708,24 @@ void Handle_EXTI_Irq(uint32_t line) {
708
708
// When executing code within a handler we must lock the GC to prevent
709
709
// any memory allocations. We must also catch any exceptions.
710
710
gc_lock ();
711
+ nlr_buf_t * nlr_abort_orig = nlr_get_abort ();
711
712
nlr_buf_t nlr ;
712
713
if (nlr_push (& nlr ) == 0 ) {
714
+ nlr_set_abort (& nlr );
713
715
mp_call_function_1 (* cb , pyb_extint_callback_arg [line ]);
714
716
nlr_pop ();
715
717
} else {
716
- // Uncaught exception; disable the callback so it doesn't run again.
717
- * cb = mp_const_none ;
718
- extint_disable (line );
719
- mp_printf (MICROPY_ERROR_PRINTER , "uncaught exception in ExtInt interrupt handler line %u\n" , (unsigned int )line );
720
- mp_obj_print_exception (& mp_plat_print , MP_OBJ_FROM_PTR (nlr .ret_val ));
718
+ nlr_set_abort (nlr_abort_orig );
719
+ if (nlr .ret_val == NULL ) {
720
+ // Reschedule the abort.
721
+ mp_sched_vm_abort ();
722
+ } else {
723
+ // Uncaught exception; disable the callback so it doesn't run again.
724
+ * cb = mp_const_none ;
725
+ extint_disable (line );
726
+ mp_printf (MICROPY_ERROR_PRINTER , "uncaught exception in ExtInt interrupt handler line %u\n" , (unsigned int )line );
727
+ mp_obj_print_exception (& mp_plat_print , MP_OBJ_FROM_PTR (nlr .ret_val ));
728
+ }
721
729
}
722
730
gc_unlock ();
723
731
mp_sched_unlock ();
You can’t perform that action at this time.
0 commit comments