unix: Unlock heap before readline.

This is intended to be equivalent to the unlock in
shared/runtime/pyexec.c.

Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
Jeff Epler 2025-08-20 16:17:19 -05:00
parent 8e596c6050
commit 065f13b114

View file

@ -209,6 +209,11 @@ static int do_repl(void) {
mp_hal_stdio_mode_raw(); mp_hal_stdio_mode_raw();
input_restart: input_restart:
// If the GC is locked at this point there is no way out except a reset,
// so force the GC to be unlocked to help the user debug what went wrong.
if (MP_STATE_THREAD(gc_lock_depth) != 0) {
MP_STATE_THREAD(gc_lock_depth) = 0;
}
vstr_reset(&line); vstr_reset(&line);
int ret = readline(&line, mp_repl_get_ps1()); int ret = readline(&line, mp_repl_get_ps1());
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;