summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-14 23:00:09 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-14 23:00:09 +0000
commit25735ba6d3f5a3cf35b3fc814a13d55dcfa29497 (patch)
tree3a150ae5ba3f99bb7c873154ee000eb35c1c89b8 /py/runtime.c
parent76f8cedb52613e27d4d5a031899154e31e00b045 (diff)
parente7299b5296d53168ec897511b1427056cb6e888a (diff)
downloadmicropython-25735ba6d3f5a3cf35b3fc814a13d55dcfa29497.tar.gz
micropython-25735ba6d3f5a3cf35b3fc814a13d55dcfa29497.zip
Merge pull request #282 from pfalcon/from-star
Implement "from mod import *"
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index f12b3e6125..d15a38e089 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1016,6 +1016,17 @@ mp_obj_t rt_import_from(mp_obj_t module, qstr name) {
return x;
}
+void rt_import_all(mp_obj_t module) {
+ DEBUG_printf("import all %p\n", module);
+
+ mp_map_t *map = mp_obj_module_get_globals(module);
+ for (uint i = 0; i < map->alloc; i++) {
+ if (map->table[i].key != MP_OBJ_NULL) {
+ rt_store_name(MP_OBJ_QSTR_VALUE(map->table[i].key), map->table[i].value);
+ }
+ }
+}
+
mp_map_t *rt_locals_get(void) {
return map_locals;
}