Skip to content

Commit

Permalink
unix/main.c: Integrate atexit to be run at the start of exit process.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leech <[email protected]>
  • Loading branch information
pi-anl authored and andrewleech committed Nov 24, 2024
1 parent 733b1d4 commit ff45348
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ports/unix/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "py/gc.h"
#include "py/objstr.h"
#include "py/cstack.h"
#include "py/modatexit.h"
#include "py/mphal.h"
#include "py/mpthread.h"
#include "extmod/misc.h"
Expand Down Expand Up @@ -748,6 +749,11 @@ MP_NOINLINE int main_(int argc, char **argv) {
}
}

#if MICROPY_PY_ATEXIT
int atexit_code = mp_atexit_execute();
ret = (atexit_code != 0) ? atexit_code : ret;
#endif

#if MICROPY_PY_SYS_SETTRACE
MP_STATE_THREAD(prof_trace_callback) = MP_OBJ_NULL;
#endif
Expand Down

0 comments on commit ff45348

Please sign in to comment.