Skip to content

Commit d23834b

Browse files
committed
py/builtinimport: Remove unreachable code and change obj-import comment.
1 parent 63e291d commit d23834b

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

py/builtinimport.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
476476
path.len = orig_path_len;
477477
} else { // MP_IMPORT_STAT_FILE
478478
do_load(module_obj, &path);
479-
// TODO: We cannot just break here, at the very least, we must execute
480-
// trailer code below. But otherwise if there're remaining components,
481-
// that would be (??) object path within module, not modules path within FS.
482-
// break;
479+
// This should be the last component in the import path. If there are
480+
// remaining components then it's an ImportError because the current path
481+
// (the module that was just loaded) is not a package. This will be caught
482+
// on the next iteration because the file will not exist.
483483
}
484484
}
485485
if (outer_module_obj != MP_OBJ_NULL) {
@@ -494,12 +494,6 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
494494
}
495495
}
496496

497-
if (i < mod_len) {
498-
// we loaded a package, now need to load objects from within that package
499-
// TODO
500-
assert(0);
501-
}
502-
503497
// If fromlist is not empty, return leaf module
504498
if (fromtuple != mp_const_none) {
505499
return module_obj;

0 commit comments

Comments
 (0)