From da1ce93da8aaa2ae050610ec51fdb3e72988a589 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 14 Feb 2014 00:22:06 +0200 Subject: Implement "from module import *" construct. --- py/runtime.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'py/runtime.c') 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; } -- cgit v1.2.3