Skip to content

Commit 7c8ec85

Browse files
committed
shared/runtime/sys_stdio_mphal: Make func static and remove some TODOs.
stdio_obj_print is private to this file so can be made static. The __del__ method does nothing so can be removed (it's only called by the GC if it exists, so if it doesn't exist it won't be called). And FileIO doesn't support a constructor in MicroPython at this stage. Signed-off-by: Damien George <[email protected]>
1 parent af54d2c commit 7c8ec85

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

shared/runtime/sys_stdio_mphal.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ typedef struct _sys_stdio_obj_t {
5252
STATIC const sys_stdio_obj_t stdio_buffer_obj;
5353
#endif
5454

55-
void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
55+
STATIC void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
5656
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
5757
mp_printf(print, "<io.FileIO %d>", self->fd);
5858
}
@@ -100,8 +100,6 @@ STATIC mp_obj_t stdio_obj___exit__(size_t n_args, const mp_obj_t *args) {
100100
}
101101
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stdio_obj___exit___obj, 4, 4, stdio_obj___exit__);
102102

103-
// TODO gc hook to close the file if not already closed
104-
105103
STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
106104
#if MICROPY_PY_SYS_STDIO_BUFFER
107105
{ MP_ROM_QSTR(MP_QSTR_buffer), MP_ROM_PTR(&stdio_buffer_obj) },
@@ -112,7 +110,6 @@ STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
112110
{ MP_ROM_QSTR(MP_QSTR_readlines), MP_ROM_PTR(&mp_stream_unbuffered_readlines_obj)},
113111
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
114112
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_identity_obj) },
115-
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_identity_obj) },
116113
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) },
117114
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&stdio_obj___exit___obj) },
118115
};
@@ -129,7 +126,6 @@ STATIC const mp_stream_p_t stdio_obj_stream_p = {
129126
STATIC const mp_obj_type_t stdio_obj_type = {
130127
{ &mp_type_type },
131128
.name = MP_QSTR_FileIO,
132-
// TODO .make_new?
133129
.print = stdio_obj_print,
134130
.getiter = mp_identity_getiter,
135131
.iternext = mp_stream_unbuffered_iter,

0 commit comments

Comments
 (0)