From 8e596c60505c21768064afaeee6ff7814668b44a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 20 Aug 2025 16:16:15 -0500 Subject: [PATCH] unix: Don't crash if heap locked in prompt_write_history. Signed-off-by: Jeff Epler --- ports/unix/input.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/unix/input.c b/ports/unix/input.c index 31926a5a8e..260e9eac8c 100644 --- a/ports/unix/input.c +++ b/ports/unix/input.c @@ -104,6 +104,9 @@ void prompt_write_history(void) { #if MICROPY_USE_READLINE == 1 char *home = getenv("HOME"); if (home != NULL) { + if (MP_STATE_THREAD(gc_lock_depth) != 0) { + return; + } vstr_t vstr; vstr_init(&vstr, 50); vstr_printf(&vstr, "%s/.micropython.history", home);