diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-12 01:01:17 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-12 01:01:17 +0100 |
commit | 19b992a862d0665bf9b543c32ee76763a9834f48 (patch) | |
tree | bd6ab77dff45410dff5e0368dea2e7198f122355 /py/builtinimport.c | |
parent | b96c7c03ca790f62e4f9409b019290946f622aa7 (diff) | |
parent | 42453dc98e95270d3802baf3d70d60c7ecabf162 (diff) |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r-- | py/builtinimport.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c index 501ced764..9eede65cd 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -218,6 +218,7 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) { if (stat == MP_IMPORT_STAT_DIR) { DEBUG_printf("%s is dir\n", vstr_str(&path)); + mp_store_attr(module_obj, MP_QSTR___path__, mp_obj_new_str((byte*)vstr_str(&path), vstr_len(&path), false)); vstr_add_char(&path, PATH_SEP_CHAR); vstr_add_str(&path, "__init__.py"); if (mp_import_stat(vstr_str(&path)) != MP_IMPORT_STAT_FILE) { @@ -230,7 +231,6 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) { vstr_cut_tail_bytes(&path, sizeof("/__init__.py") - 1); // cut off /__init__.py // https://docs.python.org/3.3/reference/import.html // "Specifically, any module that contains a __path__ attribute is considered a package." - mp_store_attr(module_obj, MP_QSTR___path__, mp_obj_new_str((byte*)vstr_str(&path), vstr_len(&path), false)); } else { // MP_IMPORT_STAT_FILE do_load(module_obj, &path); // TODO: We cannot just break here, at the very least, we must execute |