diff options
author | Damien George <damien.p.george@gmail.com> | 2016-10-07 13:58:25 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-10-07 13:58:25 +1100 |
commit | a2bfcbe029a4c0d47efe5b1b51d4cd2c010f748d (patch) | |
tree | 6a07a359d88479e774b0df94545ec52a3feccfe8 /stmhal/moduos.c | |
parent | e3d29996b3d0b1a81bd3dcc1d139e0a6ee233b03 (diff) | |
download | micropython-a2bfcbe029a4c0d47efe5b1b51d4cd2c010f748d.tar.gz micropython-a2bfcbe029a4c0d47efe5b1b51d4cd2c010f748d.zip |
stmhal: Use mp_raise_OSError helper function.
Diffstat (limited to 'stmhal/moduos.c')
-rw-r--r-- | stmhal/moduos.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/stmhal/moduos.c b/stmhal/moduos.c index c6afc22103..3fbdcbe22d 100644 --- a/stmhal/moduos.c +++ b/stmhal/moduos.c @@ -28,6 +28,7 @@ #include <string.h> #include "py/mpstate.h" +#include "py/runtime.h" #include "py/objtuple.h" #include "py/objstr.h" #include "genhdr/mpversion.h" @@ -107,7 +108,7 @@ STATIC mp_obj_t os_getcwd(void) { FRESULT res = f_getcwd(buf, sizeof buf); if (res != FR_OK) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res]))); + mp_raise_OSError(fresult_to_errno_table[res]); } return mp_obj_new_str(buf, strlen(buf), false); @@ -258,8 +259,7 @@ STATIC mp_obj_t os_stat(mp_obj_t path_in) { res = f_stat(path, &fno); } if (res != FR_OK) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, - MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res]))); + mp_raise_OSError(fresult_to_errno_table[res]); } } @@ -319,7 +319,7 @@ STATIC mp_obj_t os_statvfs(mp_obj_t path_in) { return t; error: - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res]))); + mp_raise_OSError(fresult_to_errno_table[res]); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_statvfs_obj, os_statvfs); |