diff options
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); |