summaryrefslogtreecommitdiff
path: root/tests/cmdline/cmd_module_atexit_exc.py
diff options
context:
space:
mode:
authorMike Wang <mikewang000000@gmail.com>2025-09-21 00:09:17 +0800
committerDamien George <damien@micropython.org>2025-09-23 14:13:37 +1000
commit8c389db6ea552a7a5bfcb2de644bc3e8849ef521 (patch)
tree3816180672293ef8fdb33d72aba79e330da9a25d /tests/cmdline/cmd_module_atexit_exc.py
parentcf097932a2a7ffd03958a8a14d9c87bd477ac5c3 (diff)
unix/main: Ensure atexit function is called with -m <module>.
Previously, when running `micropython -m <module>` and the module called sys.exit(), the registered atexit function was not executed. This was due to sys.exit() raising a SystemExit exception, which bypassed the atexit handler. This change fixes the issue so that the atexit function is properly invoked when exiting via sys.exit(). Additionally, following the pattern in execute_from_lexer(), mp_hal_set_interrupt_char() and mp_handle_pending() handling were added to ensure that the atexit function is also executed when the user exits via Ctrl-C. Signed-off-by: Mike Wang <mikewang000000@gmail.com>
Diffstat (limited to 'tests/cmdline/cmd_module_atexit_exc.py')
0 files changed, 0 insertions, 0 deletions