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 <damien@micropython.org>
This commit is contained in:
Damien George 2021-04-28 10:48:04 +10:00
parent a1111b83ed
commit a41cd150be

View File

@ -239,9 +239,7 @@ STATIC mp_obj_t esp_scan(mp_obj_t self_in) {
// esp_scan_list variable to NULL without disabling interrupts // esp_scan_list variable to NULL without disabling interrupts
if (MP_STATE_VM(mp_pending_exception) != NULL) { if (MP_STATE_VM(mp_pending_exception) != NULL) {
esp_scan_list = NULL; esp_scan_list = NULL;
mp_obj_t obj = MP_STATE_VM(mp_pending_exception); mp_handle_pending(true);
MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL;
nlr_raise(obj);
} }
ets_loop_iter(); ets_loop_iter();
} }