diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-15 15:53:09 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-15 15:53:09 +0100 |
commit | b92cbe612913a7c9d066c34912a3f77fe6392b2b (patch) | |
tree | ea267ba0d0d13a2dd7c4ef9ccb4b039bd993d328 /teensy | |
parent | 83695596ed4fe3ad990b68cc5ff52c26caf2174d (diff) | |
download | micropython-b92cbe612913a7c9d066c34912a3f77fe6392b2b.tar.gz micropython-b92cbe612913a7c9d066c34912a3f77fe6392b2b.zip |
py: Move definition of mp_sys_exit to core.
sys.exit always raises SystemExit so doesn't need a special
implementation for each port. If C exit() is really needed, use the
standard os._exit function.
Also initialise mp_sys_path and mp_sys_argv in teensy port.
Diffstat (limited to 'teensy')
-rw-r--r-- | teensy/main.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/teensy/main.c b/teensy/main.c index 8de26f25e8..3b2994c86f 100644 --- a/teensy/main.c +++ b/teensy/main.c @@ -269,6 +269,9 @@ soft_reset: // Micro Python init mp_init(); + mp_obj_list_init(mp_sys_path, 0); + mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR_)); // current dir (or base dir of the script) + mp_obj_list_init(mp_sys_argv, 0); readline_init0(); @@ -369,12 +372,3 @@ char * ultoa(unsigned long val, char *buf, int radix) } return buf; } - -STATIC NORETURN mp_obj_t mp_sys_exit(uint n_args, const mp_obj_t *args) { - int rc = 0; - if (n_args > 0) { - rc = mp_obj_get_int(args[0]); - } - nlr_raise(mp_obj_new_exception_arg1(&mp_type_SystemExit, mp_obj_new_int(rc))); -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit); |