Skip to content

Commit 14e9c00

Browse files
committed
py/builtinimport: Guard code needing sys.path with MICROPY_PY_SYS_PATH.
Signed-off-by: Damien George <damien@micropython.org>
1 parent b5fcb33 commit 14e9c00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

py/builtinimport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static mp_import_stat_t stat_module(vstr_t *path) {
116116
// path (i.e. "<entry>/mod_name(.py)").
117117
static mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
118118
DEBUG_printf("stat_top_level: '%s'\n", qstr_str(mod_name));
119-
#if MICROPY_PY_SYS
119+
#if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
120120
size_t path_num;
121121
mp_obj_t *path_items;
122122
mp_obj_get_array(mp_sys_path, &path_num, &path_items);
@@ -367,7 +367,7 @@ static mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name,
367367
// Immediately return if the module at this level is already loaded.
368368
mp_map_elem_t *elem;
369369

370-
#if MICROPY_PY_SYS
370+
#if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
371371
// If sys.path is empty, the intention is to force using a built-in. This
372372
// means we should also ignore any loaded modules with the same name
373373
// which may have come from the filesystem.

0 commit comments

Comments
 (0)