kopia lustrzana https://github.com/micropython/micropython
extmod/os_dupterm: Handle exception properly when it occurs in parallel.
When an exception is handled and the stream is closed, but while this happens, another exception occurs or dupterm is deactivated for another reason, the initial deactivation crashes, because its dupterm is removed. Co-authored-by: Damien George <damien@micropython.org> Signed-off-by: Felix Dörre <felix@dogcraft.de>pull/13785/head
rodzic
fb3820e3d6
commit
01c31ea804
|
@ -45,6 +45,10 @@ void mp_os_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) {
|
|||
if (exc != MP_OBJ_NULL) {
|
||||
mp_obj_print_exception(&mp_plat_print, exc);
|
||||
}
|
||||
if (term == MP_OBJ_NULL) {
|
||||
// Dupterm was already closed.
|
||||
return;
|
||||
}
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_stream_close(term);
|
||||
|
|
Ładowanie…
Reference in New Issue