diff options
| author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2025-11-05 16:35:41 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-11-22 00:06:59 +1100 |
| commit | a6864109db645045790d97b2e2b471d24a9a0560 (patch) | |
| tree | 9b435ef4c863aa8d27d0f85b5fa1bfc62a706a90 /shared/runtime/pyexec.c | |
| parent | 5f815b8a2d15a31298386d58eff5ac3c4d0fba92 (diff) | |
shared/runtime/pyexec: Set PYEXEC_FORCED_EXIT flag for SystemExit.HEADorigin/masterorigin/HEADmaster
When `MICROPY_PYEXEC_ENABLE_EXIT_CODE_HANDLING` is enabled, `SystemExit`
now sets the `PYEXEC_FORCED_EXIT` flag in addition to the exit code. This
allows the REPL to properly detect and exit when SystemExit is raised,
while still preserving the exit code in the lower bits.
Fixes `repl_lock.py` test which expects REPL to exit on `SystemExit`.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Diffstat (limited to 'shared/runtime/pyexec.c')
| -rw-r--r-- | shared/runtime/pyexec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 428cc95b2..867bf58ab 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -178,6 +178,8 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input } else { ret = PYEXEC_NORMAL_EXIT; } + // Set PYEXEC_FORCED_EXIT flag so REPL knows to exit + ret |= PYEXEC_FORCED_EXIT; #else ret = PYEXEC_FORCED_EXIT; #endif |
