diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-26 22:35:55 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-26 22:35:55 +0000 |
commit | 174bca7b5a08e44934562faf599a86caaf2cfec1 (patch) | |
tree | 81d2d1bd9c48e9b3fd4314a98fb5a8937a6039f3 /stmhal/help.c | |
parent | c3f1126ee8e0cb23b9778c6b544556ba8ba340ae (diff) |
stmhal: Remove ExtiMeta object and clean up class constants.
Diffstat (limited to 'stmhal/help.c')
-rw-r--r-- | stmhal/help.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/stmhal/help.c b/stmhal/help.c index 7dc7226b2..5cedac9d9 100644 --- a/stmhal/help.c +++ b/stmhal/help.c @@ -58,12 +58,19 @@ STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) { mp_obj_print(args[0], PRINT_STR); printf(" is of type %s\n", mp_obj_get_type_str(args[0])); - mp_obj_type_t *type = mp_obj_get_type(args[0]); mp_map_t *map = NULL; - if (type == &mp_type_module) { + if (MP_OBJ_IS_TYPE(args[0], &mp_type_module)) { map = mp_obj_module_get_globals(args[0]); - } else if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &dict_type)) { - map = mp_obj_dict_get_map(type->locals_dict); + } else { + mp_obj_type_t *type; + if (MP_OBJ_IS_TYPE(args[0], &mp_type_type)) { + type = args[0]; + } else { + type = mp_obj_get_type(args[0]); + } + if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &dict_type)) { + map = mp_obj_dict_get_map(type->locals_dict); + } } if (map != NULL) { for (uint i = 0; i < map->alloc; i++) { |