py/objobject: Don't make locals_dict if there's nothing to go in it.

This commit is contained in:
Kaspar Schleiser 2015-05-09 21:49:23 +02:00 committed by Damien George
parent cf5112b26f
commit b5cef5c7ea

View File

@ -59,7 +59,6 @@ STATIC mp_obj_t object___new__(mp_obj_t cls) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__); STATIC MP_DEFINE_CONST_FUN_OBJ_1(object___new___fun_obj, object___new__);
STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, (const mp_obj_t)&object___new___fun_obj); STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(object___new___obj, (const mp_obj_t)&object___new___fun_obj);
#endif
STATIC const mp_map_elem_t object_locals_dict_table[] = { STATIC const mp_map_elem_t object_locals_dict_table[] = {
#if MICROPY_CPYTHON_COMPAT #if MICROPY_CPYTHON_COMPAT
@ -71,10 +70,13 @@ STATIC const mp_map_elem_t object_locals_dict_table[] = {
}; };
STATIC MP_DEFINE_CONST_DICT(object_locals_dict, object_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(object_locals_dict, object_locals_dict_table);
#endif
const mp_obj_type_t mp_type_object = { const mp_obj_type_t mp_type_object = {
{ &mp_type_type }, { &mp_type_type },
.name = MP_QSTR_object, .name = MP_QSTR_object,
.make_new = object_make_new, .make_new = object_make_new,
#if MICROPY_CPYTHON_COMPAT
.locals_dict = (mp_obj_t)&object_locals_dict, .locals_dict = (mp_obj_t)&object_locals_dict,
#endif
}; };