Skip to content

Commit 54ea253

Browse files
committed
extmod/moduos_dupterm: Don't swallow exceptions in dupterm's read()/write().
The idea is that if dupterm object can handle exceptions, it will handle them itself. Otherwise, object state can be compromised and it's better to terminate dupterm session. For example, disconnected socket will keep throwing exceptions and dump messages about that.
1 parent 47442d9 commit 54ea253

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

extmod/moduos_dupterm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) {
4444
mp_call_method_n_kw(1, 0, write_m);
4545
nlr_pop();
4646
} else {
47-
// Temporarily disable dupterm to avoid infinite recursion
48-
mp_obj_t save_term = MP_STATE_PORT(term_obj);
4947
MP_STATE_PORT(term_obj) = NULL;
50-
mp_printf(&mp_plat_print, "dupterm: ");
48+
mp_printf(&mp_plat_print, "dupterm: Exception in write() method, deactivating: ");
5149
mp_obj_print_exception(&mp_plat_print, nlr.ret_val);
52-
MP_STATE_PORT(term_obj) = save_term;
5350
}
5451
}
5552
}

0 commit comments

Comments
 (0)