diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/mpstate.h | 2 | ||||
-rw-r--r-- | py/runtime.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/py/mpstate.h b/py/mpstate.h index eca14a9e4..6a39ebdea 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -168,7 +168,7 @@ typedef struct _mp_state_vm_t { // root pointers for extmod #if MICROPY_PY_OS_DUPTERM - mp_obj_t term_obj; + mp_obj_t dupterm_objs[MICROPY_PY_OS_DUPTERM]; mp_obj_t dupterm_arr_obj; #endif diff --git a/py/runtime.c b/py/runtime.c index 069548deb..17e5d235c 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -102,6 +102,13 @@ void mp_init(void) { MP_STATE_VM(mp_module_builtins_override_dict) = NULL; #endif + #if MICROPY_PY_OS_DUPTERM + for (size_t i = 0; i < MICROPY_PY_OS_DUPTERM; ++i) { + MP_STATE_VM(dupterm_objs[i]) = MP_OBJ_NULL; + } + MP_STATE_VM(dupterm_arr_obj) = MP_OBJ_NULL; + #endif + #if MICROPY_FSUSERMOUNT // zero out the pointers to the user-mounted devices memset(MP_STATE_VM(fs_user_mount), 0, sizeof(MP_STATE_VM(fs_user_mount))); |