diff options
author | John R. Lenton <jlenton@gmail.com> | 2014-01-07 18:01:08 +0000 |
---|---|---|
committer | John R. Lenton <jlenton@gmail.com> | 2014-01-07 18:01:08 +0000 |
commit | 270112f7312f724e46ae34649dfce3ec43b697e0 (patch) | |
tree | d7438ae877350aede062d8ac7e62e52ab35cb018 /py/objmodule.c | |
parent | c06763a0207dde7f2060f7b1670a0b99298a01f8 (diff) | |
parent | fd04bb3bacf5dbc4d79c04a49520e3e81abb7352 (diff) |
Merge remote-tracking branch 'upstream/master' into listsort. Lots of conflict fun.
Conflicts:
py/obj.h
py/objbool.c
py/objboundmeth.c
py/objcell.c
py/objclass.c
py/objclosure.c
py/objcomplex.c
py/objdict.c
py/objexcept.c
py/objfun.c
py/objgenerator.c
py/objinstance.c
py/objmodule.c
py/objrange.c
py/objset.c
py/objslice.c
Diffstat (limited to 'py/objmodule.c')
-rw-r--r-- | py/objmodule.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/py/objmodule.c b/py/objmodule.c index df49ec670..7b92b76f4 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -6,6 +6,7 @@ #include "nlr.h" #include "misc.h" #include "mpconfig.h" +#include "mpqstr.h" #include "obj.h" #include "runtime.h" #include "map.h" @@ -22,17 +23,17 @@ void module_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_ } const mp_obj_type_t module_type = { - .base = { &mp_const_type }, - .name = "module", + { &mp_const_type }, + "module", .print = module_print, - .methods = {{NULL, NULL},}, }; mp_obj_t mp_obj_new_module(qstr module_name) { mp_obj_module_t *o = m_new_obj(mp_obj_module_t); o->base.type = &module_type; o->name = module_name; - o->globals = mp_map_new(MP_MAP_QSTR, 0); + o->globals = mp_map_new(MP_MAP_QSTR, 1); + mp_qstr_map_lookup(o->globals, MP_QSTR___name__, true)->value = mp_obj_new_str(module_name); return o; } |