summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-13 16:32:57 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-13 16:34:17 +0300
commit19e3c9d53a86cb8696bab93d645f6e63dfd26c2f (patch)
treec6f5b4060a394ea49177af815b6e0cccd553af3d
parent54ea253f5699c791ddff073b0193f257fa77cee1 (diff)
downloadmicropython-19e3c9d53a86cb8696bab93d645f6e63dfd26c2f.tar.gz
micropython-19e3c9d53a86cb8696bab93d645f6e63dfd26c2f.zip
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.
-rw-r--r--esp8266/esp_mphal.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c
index 2f813ca22f..4427c44976 100644
--- a/esp8266/esp_mphal.c
+++ b/esp8266/esp_mphal.c
@@ -185,12 +185,9 @@ static int call_dupterm_read(void) {
nlr_pop();
return *(byte*)bufinfo.buf;
} else {
- // Temporarily disable dupterm to avoid infinite recursion
- mp_obj_t save_term = MP_STATE_PORT(term_obj);
MP_STATE_PORT(term_obj) = NULL;
- mp_printf(&mp_plat_print, "dupterm: ");
+ mp_printf(&mp_plat_print, "dupterm: Exception in read() method, deactivating: ");
mp_obj_print_exception(&mp_plat_print, nlr.ret_val);
- MP_STATE_PORT(term_obj) = save_term;
}
return -1;