diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-22 14:35:10 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-22 14:35:10 +0000 |
commit | 5fa93b67557f21c22a41449c3266571c427f6798 (patch) | |
tree | 3e009ed9369b7aba8cf5212509a784ecd86e06a3 /py/builtinimport.c | |
parent | 8ae1c1beacc56d440b2cc1e4bd010b100ad4fdd0 (diff) |
Second stage of qstr revamp: uPy str object can be qstr or not.
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r-- | py/builtinimport.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c index 4cdad4e24..3cfd64e88 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -29,7 +29,10 @@ mp_obj_t mp_builtin___import__(int n_args, mp_obj_t *args) { } */ - qstr mod_name = mp_obj_get_qstr(args[0]); + uint mod_name_l; + const byte *mod_name_s = mp_obj_str_get_data(args[0], &mod_name_l); + qstr mod_name = qstr_from_strn((const char*)mod_name_s, mod_name_l); + mp_obj_t loaded = mp_obj_module_get(mod_name); if (loaded != MP_OBJ_NULL) { return loaded; @@ -43,7 +46,7 @@ mp_obj_t mp_builtin___import__(int n_args, mp_obj_t *args) { } // create a new module object - mp_obj_t module_obj = mp_obj_new_module(mp_obj_get_qstr(args[0])); + mp_obj_t module_obj = mp_obj_new_module(mod_name); // save the old context mp_map_t *old_locals = rt_locals_get(); |