From 7a16fadbf843ca5d49fb20b5f5785ffccfd9019f Mon Sep 17 00:00:00 2001 From: ian-v Date: Mon, 6 Jan 2014 09:52:29 -0800 Subject: Co-exist with C++ (issue #85) --- py/objmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/objmodule.c') diff --git a/py/objmodule.c b/py/objmodule.c index 2d6f9555e..3412573eb 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -31,7 +31,7 @@ const mp_obj_type_t module_type = { NULL, // binary_op NULL, // getiter NULL, // iternext - .methods = {{NULL, NULL},}, + .methods = NULL, }; mp_obj_t mp_obj_new_module(qstr module_name) { -- cgit v1.2.3 From 7b21c2d8f01b33b35463cb22487b1235aa7446a4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 7 Jan 2014 16:54:58 +0000 Subject: py: Fix allocation of unique code blocks. --- py/objmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'py/objmodule.c') 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; } -- cgit v1.2.3