diff --git a/extmod/vfs.c b/extmod/vfs.c index f35b4cabe6..125370b588 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -361,7 +361,7 @@ mp_obj_t mp_vfs_getcwd(void) { if (!(cwd[0] == '/' && cwd[1] == 0)) { vstr_add_str(&vstr, cwd); } - return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); + return mp_obj_new_str_from_vstr(&vstr); } MP_DEFINE_CONST_FUN_OBJ_0(mp_vfs_getcwd_obj, mp_vfs_getcwd); diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index f9f21f6e35..02910f24de 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -136,6 +136,7 @@ STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(fat_vfs_mkfs_obj, MP_ROM_PTR(&fat_vfs_mk typedef struct _mp_vfs_fat_ilistdir_it_t { mp_obj_base_t base; mp_fun_1_t iternext; + mp_fun_1_t finaliser; bool is_str; FF_DIR dir; } mp_vfs_fat_ilistdir_it_t; diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index 81f07e1803..a04b0a5971 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -205,7 +205,7 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i const mp_obj_type_t *type = &mp_type_vfs_fat_textio; int mode = 0; - const char *mode_s = mp_obj_str_get_str(args[1].u_obj); + const char *mode_s = mp_obj_str_get_str(mode_in); uint32_t rwxa_count = 0; uint32_t bt_count = 0; uint32_t plus_count = 0; @@ -252,8 +252,8 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i mp_arg_error_invalid(MP_QSTR_mode); } - assert(vfs != NULL); - if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(vfs)) { + assert(self != NULL); + if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(self)) { mp_raise_OSError(MP_EROFS); } @@ -261,11 +261,11 @@ STATIC mp_obj_t fat_vfs_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode_i pyb_file_obj_t *o = m_new_obj_with_finaliser(pyb_file_obj_t); o->base.type = type; - const char *fname = mp_obj_str_get_str(args[0].u_obj); - FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode); + const char *fname = mp_obj_str_get_str(path_in); + FRESULT res = f_open(&self->fatfs, &o->fp, fname, mode); if (res != FR_OK) { m_del_obj(pyb_file_obj_t, o); - mp_raise_OSError_errno_str(fresult_to_errno_table[res], args[0].u_obj); + mp_raise_OSError_errno_str(fresult_to_errno_table[res], path_in); } // CIRCUITPY does fast seek. // If we're reading, turn on fast seek.