Skip to content
Snippets Groups Projects
Commit f5d46a88 authored by Damien George's avatar Damien George
Browse files

lib/utils/pyexec: Forcefully unlock the heap if locked and REPL active.

Otherwise there is really nothing that can be done, it can't be unlocked by
the user because there is no way to allocate memory to execute the unlock.

See issue #4205 and #4209.
parent 7059b4af
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,9 @@ Functions
in a row and the lock-depth will increase, and then `heap_unlock()` must be
called the same number of times to make the heap available again.
If the REPL becomes active with the heap locked then it will be forcefully
unlocked.
.. function:: kbd_intr(chr)
Set the character that will raise a `KeyboardInterrupt` exception. By
......
......@@ -419,6 +419,12 @@ friendly_repl_reset:
}
#endif
// 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_MEM(gc_lock_depth) != 0) {
MP_STATE_MEM(gc_lock_depth) = 0;
}
vstr_reset(&line);
int ret = readline(&line, ">>> ");
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment