Skip to content

Commit 19e3c9d

Browse files
committed
esp8266/esp_mphal: 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 54ea253 commit 19e3c9d

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

esp8266/esp_mphal.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,9 @@ static int call_dupterm_read(void) {
185185
nlr_pop();
186186
return *(byte*)bufinfo.buf;
187187
} else {
188-
// Temporarily disable dupterm to avoid infinite recursion
189-
mp_obj_t save_term = MP_STATE_PORT(term_obj);
190188
MP_STATE_PORT(term_obj) = NULL;
191-
mp_printf(&mp_plat_print, "dupterm: ");
189+
mp_printf(&mp_plat_print, "dupterm: Exception in read() method, deactivating: ");
192190
mp_obj_print_exception(&mp_plat_print, nlr.ret_val);
193-
MP_STATE_PORT(term_obj) = save_term;
194191
}
195192

196193
return -1;

0 commit comments

Comments
 (0)