summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-26 15:31:13 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 10:30:20 +1100
commita642241a12116def88da5e98009d6a5f205969ba (patch)
treefe7cefab80ca4f82bce5f9ff7b65328eec0eee1d /py
parent2b50afaee483c64dbe80e9d85328f7100114c467 (diff)
py/builtinimport: Adjust if-block order in find_file to clean up #if's.
Diffstat (limited to 'py')
-rw-r--r--py/builtinimport.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index aef1a8017..23ab16683 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -102,13 +102,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
mp_obj_t *path_items;
mp_obj_list_get(mp_sys_path, &path_num, &path_items);
- if (path_num == 0) {
-#endif
- // mp_sys_path is empty, so just use the given file name
- vstr_add_strn(dest, file_str, file_len);
- return stat_dir_or_file(dest);
-#if MICROPY_PY_SYS
- } else {
+ if (path_num != 0) {
// go through each path looking for a directory or file
for (size_t i = 0; i < path_num; i++) {
vstr_reset(dest);
@@ -129,6 +123,10 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
return MP_IMPORT_STAT_NO_EXIST;
}
#endif
+
+ // mp_sys_path is empty, so just use the given file name
+ vstr_add_strn(dest, file_str, file_len);
+ return stat_dir_or_file(dest);
}
#if MICROPY_MODULE_FROZEN_STR || MICROPY_ENABLE_COMPILER