summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-08-15 14:17:09 +1000
committerDamien George <damien@micropython.org>2025-08-22 13:30:46 +1000
commit14e9c00cb99465236c579da722a72a9cfc4ef12f (patch)
tree5ac9b18139d06ad511c0d981ec671b15e664c4ee
parentb5fcb33eaa682bb666c839cd4fb301175cc3564f (diff)
py/builtinimport: Guard code needing sys.path with MICROPY_PY_SYS_PATH.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--py/builtinimport.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index a2737a03e..57b5c14e8 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -116,7 +116,7 @@ static mp_import_stat_t stat_module(vstr_t *path) {
// path (i.e. "<entry>/mod_name(.py)").
static mp_import_stat_t stat_top_level(qstr mod_name, vstr_t *dest) {
DEBUG_printf("stat_top_level: '%s'\n", qstr_str(mod_name));
- #if MICROPY_PY_SYS
+ #if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
size_t path_num;
mp_obj_t *path_items;
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,
// Immediately return if the module at this level is already loaded.
mp_map_elem_t *elem;
- #if MICROPY_PY_SYS
+ #if MICROPY_PY_SYS && MICROPY_PY_SYS_PATH
// If sys.path is empty, the intention is to force using a built-in. This
// means we should also ignore any loaded modules with the same name
// which may have come from the filesystem.