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