Skip to content

Commit 0f14fde

Browse files
committed
stmhal: Implement draft version of sys.exit().
1 parent d99e908 commit 0f14fde

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

stmhal/main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "mpconfig.h"
3636
#include "qstr.h"
3737
#include "misc.h"
38+
#include "nlr.h"
3839
#include "lexer.h"
3940
#include "parse.h"
4041
#include "obj.h"
@@ -549,3 +550,13 @@ int main(void) {
549550
first_soft_reset = false;
550551
goto soft_reset;
551552
}
553+
554+
STATIC NORETURN mp_obj_t mp_sys_exit(uint n_args, const mp_obj_t *args) {
555+
int rc = 0;
556+
if (n_args > 0) {
557+
rc = mp_obj_get_int(args[0]);
558+
}
559+
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_NotImplementedError,
560+
"sys.exit(%d) called, is not fully implemented", rc));
561+
}
562+
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);

0 commit comments

Comments
 (0)