summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2025-08-20 16:16:15 -0500
committerJeff Epler <jepler@gmail.com>2025-09-01 21:29:05 -0500
commit30c1b6e3d1ab0acd532b6f064e4466d605224460 (patch)
treed25f42b4889e3e3f43a8e0a172c24a15553b1ec3
parent3adf0163765f3de76167705c8dc38bfd0f56e08a (diff)
unix: Don't crash if heap locked in prompt_write_history.
Signed-off-by: Jeff Epler <jepler@gmail.com>
-rw-r--r--ports/unix/input.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/unix/input.c b/ports/unix/input.c
index 31926a5a8..260e9eac8 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);