Skip to content

Commit e5fa163

Browse files
committed
unix/file: Parse "buffering" argument of open() builtin.
It's ignored (unbuffered, raw I/O is used), but least makes it compatible with CPython.
1 parent a0cb4ed commit e5fa163

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

unix/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
148148
STATIC const mp_arg_t file_open_args[] = {
149149
{ MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
150150
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_r)} },
151+
{ MP_QSTR_buffering, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
151152
{ MP_QSTR_encoding, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
152153
};
153154
#define FILE_OPEN_NUM_ARGS MP_ARRAY_SIZE(file_open_args)

unix/qstrdefsport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Q(Test)
3030

3131
Q(fileno)
3232
Q(makefile)
33+
Q(buffering)
3334

3435
Q(FileIO)
3536
Q(flush)

0 commit comments

Comments
 (0)