From a41cd150be01adc59828ead26a01a9d9324773e1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 28 Apr 2021 10:48:04 +1000 Subject: [PATCH] esp8266/modnetwork: Use mp_handle_pending() to raise pending exception. If MICROPY_ENABLE_SCHEDULER is enabled then MP_STATE_VM(sched_state) must be updated after handling the pending exception, which is done by the mp_handle_pending() function. Signed-off-by: Damien George --- ports/esp8266/modnetwork.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c index cad53d912c..3b8ef4b21f 100644 --- a/ports/esp8266/modnetwork.c +++ b/ports/esp8266/modnetwork.c @@ -239,9 +239,7 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) { // esp_scan_list variable to NULL without disabling interrupts if (MP_STATE_VM(mp_pending_exception) != NULL) { esp_scan_list = NULL; - mp_obj_t obj = MP_STATE_VM(mp_pending_exception); - MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; - nlr_raise(obj); + mp_handle_pending(true); } ets_loop_iter(); }