unix: Enable sys.atexit, triggered after the main script ends.

This commit is contained in:
Milan Rossa 2019-08-05 15:11:24 +02:00 committed by Damien George
parent cb3647004f
commit 6f0c6bd774
2 changed files with 7 additions and 0 deletions

View File

@ -642,6 +642,12 @@ MP_NOINLINE int main_(int argc, char **argv) {
}
}
#if MICROPY_PY_SYS_ATEXIT
if (mp_obj_is_callable(MP_STATE_VM(sys_exitfunc))) {
mp_call_function_0(MP_STATE_VM(sys_exitfunc));
}
#endif
#if MICROPY_PY_MICROPYTHON_MEM_INFO
if (mp_verbose_flag) {
mp_micropython_mem_info(0, NULL);

View File

@ -90,6 +90,7 @@
#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1)
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_SYS_EXIT (1)
#define MICROPY_PY_SYS_ATEXIT (1)
#if defined(__APPLE__) && defined(__MACH__)
#define MICROPY_PY_SYS_PLATFORM "darwin"
#else