Skip to content

Commit 6404d46

Browse files
committed
shared/runtime/pyexec: Integrate atexit to be run during exit process.
Signed-off-by: Andrew Leech <[email protected]>
1 parent 0f322b7 commit 6404d46

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

shared/runtime/pyexec.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ static int parse_compile_execute(const void *source, mp_parse_input_kind_t input
188188
mp_hal_stdout_tx_strn("\x04", 1);
189189
}
190190

191+
#if MICROPY_PY_ATEXIT
192+
int atexit_code = mp_atexit_execute();
193+
ret = (atexit_code != 0) ? atexit_code : ret;
194+
#endif
195+
191196
#ifdef MICROPY_BOARD_AFTER_PYTHON_EXEC
192197
MICROPY_BOARD_AFTER_PYTHON_EXEC(input_kind, exec_flags, nlr.ret_val, &ret);
193198
#endif

0 commit comments

Comments
 (0)