File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ STATIC const mp_map_elem_t mp_module_sys_globals_table[] = {
2323 { MP_OBJ_NEW_QSTR (MP_QSTR_path ), (mp_obj_t )& mp_sys_path_obj },
2424 { MP_OBJ_NEW_QSTR (MP_QSTR_argv ), (mp_obj_t )& mp_sys_argv_obj },
2525
26+ #if MICROPY_MOD_SYS_STDFILES
2627 { MP_OBJ_NEW_QSTR (MP_QSTR_stdin ), (mp_obj_t )& mp_sys_stdin_obj },
2728 { MP_OBJ_NEW_QSTR (MP_QSTR_stdout ), (mp_obj_t )& mp_sys_stdout_obj },
2829 { MP_OBJ_NEW_QSTR (MP_QSTR_stderr ), (mp_obj_t )& mp_sys_stderr_obj },
30+ #endif
2931};
3032
3133STATIC const mp_obj_dict_t mp_module_sys_globals = {
Original file line number Diff line number Diff line change @@ -125,6 +125,10 @@ typedef double mp_float_t;
125125#define MICROPY_ENABLE_MOD_SYS (1)
126126#endif
127127
128+ #ifndef MICROPY_MOD_SYS_STDFILES
129+ #define MICROPY_MOD_SYS_STDFILES (0)
130+ #endif
131+
128132// Whether to support slice object and correspondingly
129133// slice subscript operators
130134#ifndef MICROPY_ENABLE_SLICE
Original file line number Diff line number Diff line change @@ -263,10 +263,9 @@ int main(void) {
263263 // Micro Python init
264264 qstr_init ();
265265 mp_init ();
266- mp_obj_t def_path [2 ];
267- def_path [0 ] = MP_OBJ_NEW_QSTR (MP_QSTR_0_colon__slash_ );
268- def_path [1 ] = MP_OBJ_NEW_QSTR (MP_QSTR_0_colon__slash_lib );
269- mp_sys_path = mp_obj_new_list (2 , def_path );
266+ mp_obj_list_init (mp_sys_path , 0 );
267+ mp_obj_list_append (mp_sys_argv , MP_OBJ_NEW_QSTR (MP_QSTR_0_colon__slash_ ));
268+ mp_obj_list_append (mp_sys_argv , MP_OBJ_NEW_QSTR (MP_QSTR_0_colon__slash_lib ));
270269
271270 readline_init ();
272271
Original file line number Diff line number Diff line change 1313#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE)
1414#define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ)
1515#define MICROPY_PATH_MAX (PATH_MAX)
16+ #define MICROPY_MOD_SYS_STDFILES (1)
1617
1718// type definitions for the specific machine
1819
You can’t perform that action at this time.
0 commit comments