Skip to content
This repository was archived by the owner on Oct 28, 2023. It is now read-only.

Commit 7ecfbb8

Browse files
committed
extmod/vfs: Allow "buffering" and "encoding" args to VFS's open().
These args are currently ignored but are parsed to make it easier to write portable scripts between CPython and MicroPython.
1 parent f6ef8e3 commit 7ecfbb8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

extmod/vfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,14 @@ mp_obj_t mp_vfs_umount(mp_obj_t mnt_in) {
228228
}
229229
MP_DEFINE_CONST_FUN_OBJ_1(mp_vfs_umount_obj, mp_vfs_umount);
230230

231+
// Note: buffering and encoding args are currently ignored
231232
mp_obj_t mp_vfs_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
232233
enum { ARG_file, ARG_mode, ARG_encoding };
233234
static const mp_arg_t allowed_args[] = {
234235
{ MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
235236
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_QSTR(MP_QSTR_r)} },
237+
{ MP_QSTR_buffering, MP_ARG_INT, {.u_int = -1} },
238+
{ MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
236239
};
237240

238241
// parse args

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy