diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-07 16:54:58 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-07 16:54:58 +0000 |
commit | 7b21c2d8f01b33b35463cb22487b1235aa7446a4 (patch) | |
tree | b0c9fb412d0e5280d3773871749feb2571460683 /py/objmodule.c | |
parent | 97209d38e17a0f3cb2a2d3f03d726fd322b4808f (diff) |
py: Fix allocation of unique code blocks.
Diffstat (limited to 'py/objmodule.c')
-rw-r--r-- | py/objmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/objmodule.c b/py/objmodule.c index 3e7a0f7fc..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" @@ -31,7 +32,8 @@ 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; } |