mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
py: Fix allocation of unique code blocks.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user