diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index d0cc9e396e773..7360c5c09086f 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -66,6 +66,7 @@ #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_STREAMS_POSIX_API (1) +#define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_OPT_COMPUTED_GOTO (1) #ifndef MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (1) diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 81464d72a7f13..2361c2647f07e 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -58,6 +58,7 @@ #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_STREAMS_POSIX_API (1) +#define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_OPT_COMPUTED_GOTO (0) #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (1) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) diff --git a/py/builtin.h b/py/builtin.h index 2066c0617396e..789f7d74c10e3 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -89,7 +89,7 @@ MP_DECLARE_CONST_FUN_OBJ_2(mp_op_delitem_obj); extern const mp_obj_module_t mp_module___main__; extern const mp_obj_module_t mp_module_builtins; -extern const mp_obj_module_t mp_module_array; +extern const mp_obj_module_t mp_module_uarray; extern const mp_obj_module_t mp_module_collections; extern const mp_obj_module_t mp_module_io; extern const mp_obj_module_t mp_module_math; diff --git a/py/modarray.c b/py/modarray.c index c0cdca9286f1f..a6bfb07ba846c 100644 --- a/py/modarray.c +++ b/py/modarray.c @@ -29,13 +29,13 @@ #if MICROPY_PY_ARRAY STATIC const mp_rom_map_elem_t mp_module_array_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_array) }, + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uarray) }, { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_type_array) }, }; STATIC MP_DEFINE_CONST_DICT(mp_module_array_globals, mp_module_array_globals_table); -const mp_obj_module_t mp_module_array = { +const mp_obj_module_t mp_module_uarray = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&mp_module_array_globals, }; diff --git a/py/objmodule.c b/py/objmodule.c index 3a00b7ddc1aeb..4548194d3d240 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -137,7 +137,7 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { { MP_ROM_QSTR(MP_QSTR_micropython), MP_ROM_PTR(&mp_module_micropython) }, #if MICROPY_PY_ARRAY - { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_module_array) }, + { MP_ROM_QSTR(MP_QSTR_uarray), MP_ROM_PTR(&mp_module_uarray) }, #endif #if MICROPY_PY_IO { MP_ROM_QSTR(MP_QSTR_uio), MP_ROM_PTR(&mp_module_io) }, @@ -232,6 +232,11 @@ MP_DEFINE_CONST_MAP(mp_builtin_module_map, mp_builtin_module_table); #if MICROPY_MODULE_WEAK_LINKS STATIC const mp_rom_map_elem_t mp_builtin_module_weak_links_table[] = { + #if MICROPY_PY_ARRAY + { MP_ROM_QSTR(MP_QSTR_array), MP_ROM_PTR(&mp_module_uarray) }, + #endif + + // extra weak links as defined by a port MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS };