Commit 238ab501 authored by Sven Wegener's avatar Sven Wegener Committed by Damien George
Browse files

py: Deactivate more code without MICROPY_PY_SYS

When compiler optimization has been turned on, gcc knows that this code
block is not going to be executed. But with -O0 it complains about
path_items being used uninitialized.
Signed-off-by: default avatarSven Wegener <>
parent 98d8d59c
......@@ -77,17 +77,18 @@ STATIC mp_import_stat_t stat_dir_or_file(vstr_t *path) {
STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *dest) {
// extract the list of paths
mp_uint_t path_num = 0;
mp_uint_t path_num;
mp_obj_t *path_items;
mp_obj_list_get(mp_sys_path, &path_num, &path_items);
if (path_num == 0) {
// 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);
} else {
// go through each path looking for a directory or file
for (mp_uint_t i = 0; i < path_num; i++) {
......@@ -108,6 +109,7 @@ STATIC mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *d
// could not find a directory or file
STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment