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 @@ -708,16 +708,24 @@ void Handle_EXTI_Irq(uint32_t line) {
708708 // When executing code within a handler we must lock the GC to prevent
709709 // any memory allocations. We must also catch any exceptions.
710710 gc_lock ();
711+ nlr_buf_t * nlr_abort_orig = nlr_get_abort ();
711712 nlr_buf_t nlr ;
712713 if (nlr_push (& nlr ) == 0 ) {
714+ nlr_set_abort (& nlr );
713715 mp_call_function_1 (* cb , pyb_extint_callback_arg [line ]);
714716 nlr_pop ();
715717 } 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+ }
721729 }
722730 gc_unlock ();
723731 mp_sched_unlock ();
You can’t perform that action at this time.
0 commit comments