summaryrefslogtreecommitdiff
path: root/ports/unix/file.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-12-16 15:40:05 +1100
committerDamien George <damien.p.george@gmail.com>2019-12-27 22:51:17 +1100
commit09376f0e47b3ab4a5a2a3c2c768ff913e1835cc8 (patch)
tree4fd6399e318c977b3ddd20c13659f176b70f3f5b /ports/unix/file.c
parentf5eec903fa961135296e2656821450979e413248 (diff)
py: Introduce MP_ROM_NONE macro for ROM to refer to None object.
This helps to prevent mistakes, and allows easily changing the ROM value of None if needed.
Diffstat (limited to 'ports/unix/file.c')
-rw-r--r--ports/unix/file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ports/unix/file.c b/ports/unix/file.c
index bb841da20..6c6e26b0b 100644
--- a/ports/unix/file.c
+++ b/ports/unix/file.c
@@ -148,10 +148,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
// Note: encoding is ignored for now; it's also not a valid kwarg for CPython's FileIO,
// but by adding it here we can use one single mp_arg_t array for open() and FileIO's constructor
STATIC const mp_arg_t file_open_args[] = {
- { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
+ { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE} },
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_r)} },
- { MP_QSTR_buffering, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
- { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
+ { MP_QSTR_buffering, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
+ { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
};
#define FILE_OPEN_NUM_ARGS MP_ARRAY_SIZE(file_open_args)