diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-14 23:44:20 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-14 23:44:20 +0100 |
commit | e10da77a5c4711287319b762c3238121ac10f48e (patch) | |
tree | ed3e62de403a95d1c58a55fb5bcbc8eb7f7e837c /py/builtinimport.c | |
parent | 8341725b6513d01045787bdb51952cceb35c29da (diff) | |
parent | a5854d2bc5717cb5b6f589f367acaa6d0c8b0179 (diff) |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r-- | py/builtinimport.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c index 3f63768ad..262ee04a5 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -292,11 +292,10 @@ mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) { vstr_add_str(&path, "__init__.py"); if (mp_import_stat(vstr_str(&path)) != MP_IMPORT_STAT_FILE) { vstr_cut_tail_bytes(&path, sizeof("/__init__.py") - 1); // cut off /__init__.py - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ImportError, - "Per PEP-420 a dir without __init__.py (%s) is a namespace package; " - "namespace packages are not supported", vstr_str(&path))); + printf("Notice: %s is imported as namespace package\n", vstr_str(&path)); + } else { + do_load(module_obj, &path); } - do_load(module_obj, &path); 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." |