summaryrefslogtreecommitdiffstatshomepage
path: root/py/builtinimport.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r--py/builtinimport.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 2910f8d974..a8f6a81741 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -44,7 +44,6 @@
#include "runtime0.h"
#include "runtime.h"
#include "builtin.h"
-#include "builtintables.h"
#if 0 // print debugging info
#define DEBUG_PRINT (1)
@@ -56,6 +55,14 @@
#define PATH_SEP_CHAR '/'
+#if MICROPY_MODULE_WEAK_LINKS
+STATIC const mp_map_elem_t mp_builtin_module_weak_links_table[] = {
+ MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS
+};
+
+STATIC MP_DEFINE_CONST_MAP(mp_builtin_module_weak_links_map, mp_builtin_module_weak_links_table);
+#endif
+
bool mp_obj_is_package(mp_obj_t module) {
mp_obj_t dest[2];
mp_load_method_maybe(module, MP_QSTR___path__, dest);
@@ -270,7 +277,7 @@ mp_obj_t mp_builtin___import__(mp_uint_t n_args, const mp_obj_t *args) {
#if MICROPY_MODULE_WEAK_LINKS
// check if there is a weak link to this module
if (i == mod_len) {
- mp_map_elem_t *el = mp_map_lookup((mp_map_t*)&mp_builtin_module_weak_links_dict_obj.map, MP_OBJ_NEW_QSTR(mod_name), MP_MAP_LOOKUP);
+ mp_map_elem_t *el = mp_map_lookup((mp_map_t*)&mp_builtin_module_weak_links_map, MP_OBJ_NEW_QSTR(mod_name), MP_MAP_LOOKUP);
if (el == NULL) {
goto no_exist;
}