py/builtinimport: Remove unreachable code and change obj-import comment.

This commit is contained in:
Damien George 2017-01-16 16:40:47 +11:00
parent 63e291de70
commit d23834bc96
1 changed files with 4 additions and 10 deletions

View File

@ -476,10 +476,10 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) {
path.len = orig_path_len; path.len = orig_path_len;
} else { // MP_IMPORT_STAT_FILE } else { // MP_IMPORT_STAT_FILE
do_load(module_obj, &path); do_load(module_obj, &path);
// TODO: We cannot just break here, at the very least, we must execute // This should be the last component in the import path. If there are
// trailer code below. But otherwise if there're remaining components, // remaining components then it's an ImportError because the current path
// that would be (??) object path within module, not modules path within FS. // (the module that was just loaded) is not a package. This will be caught
// break; // on the next iteration because the file will not exist.
} }
} }
if (outer_module_obj != MP_OBJ_NULL) { 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) {
} }
} }
if (i < mod_len) {
// we loaded a package, now need to load objects from within that package
// TODO
assert(0);
}
// If fromlist is not empty, return leaf module // If fromlist is not empty, return leaf module
if (fromtuple != mp_const_none) { if (fromtuple != mp_const_none) {
return module_obj; return module_obj;