diff options
-rw-r--r-- | py/modsys.c | 2 | ||||
-rw-r--r-- | py/mpconfig.h | 4 | ||||
-rw-r--r-- | stmhal/main.c | 7 | ||||
-rw-r--r-- | unix/mpconfigport.h | 1 |
4 files changed, 10 insertions, 4 deletions
diff --git a/py/modsys.c b/py/modsys.c index 7f8cd68a8d..59539b3b90 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -23,9 +23,11 @@ STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_path), (mp_obj_t)&mp_sys_path_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj }, +#if MICROPY_MOD_SYS_STDFILES { MP_OBJ_NEW_QSTR(MP_QSTR_stdin), (mp_obj_t)&mp_sys_stdin_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stdout), (mp_obj_t)&mp_sys_stdout_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_stderr), (mp_obj_t)&mp_sys_stderr_obj }, +#endif }; STATIC const mp_obj_dict_t mp_module_sys_globals = { diff --git a/py/mpconfig.h b/py/mpconfig.h index 119d0177dd..cbe18b409b 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -125,6 +125,10 @@ typedef double mp_float_t; #define MICROPY_ENABLE_MOD_SYS (1) #endif +#ifndef MICROPY_MOD_SYS_STDFILES +#define MICROPY_MOD_SYS_STDFILES (0) +#endif + // Whether to support slice object and correspondingly // slice subscript operators #ifndef MICROPY_ENABLE_SLICE diff --git a/stmhal/main.c b/stmhal/main.c index 29c704b10e..efaf7caf9d 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -263,10 +263,9 @@ soft_reset: // Micro Python init qstr_init(); mp_init(); - mp_obj_t def_path[2]; - def_path[0] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_); - def_path[1] = MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib); - mp_sys_path = mp_obj_new_list(2, def_path); + mp_obj_list_init(mp_sys_path, 0); + mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_)); + mp_obj_list_append(mp_sys_argv, MP_OBJ_NEW_QSTR(MP_QSTR_0_colon__slash_lib)); readline_init(); diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index e2f2a69e11..832bdb05fb 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -13,6 +13,7 @@ #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_PATH_MAX (PATH_MAX) +#define MICROPY_MOD_SYS_STDFILES (1) // type definitions for the specific machine |