summaryrefslogtreecommitdiff
path: root/py/builtinhelp.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-10-24 22:31:16 -0700
committerScott Shawcroft <scott.shawcroft@gmail.com>2017-10-24 22:31:16 -0700
commit73c15dcf8b1b927757a595a867334b38355ddb8f (patch)
treeb1727518e47219b995611aa7e5c9da66e3df5075 /py/builtinhelp.c
parentd43564f854a6a1202dfff550986b9343952d5d32 (diff)
parentf869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c (diff)
Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge
This is prep for merging in the NRF5 pull request.
Diffstat (limited to 'py/builtinhelp.c')
-rw-r--r--py/builtinhelp.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/py/builtinhelp.c b/py/builtinhelp.c
index 9903f2690..1cea8caac 100644
--- a/py/builtinhelp.c
+++ b/py/builtinhelp.c
@@ -33,7 +33,7 @@
#if MICROPY_PY_BUILTINS_HELP
-const char *mp_help_default_text =
+const char mp_help_default_text[] =
"Welcome to MicroPython!\n"
"\n"
"For online docs please visit http://docs.micropython.org/\n"
@@ -145,20 +145,19 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
}
#endif
+ mp_obj_type_t *type = mp_obj_get_type(obj);
+
// try to print something sensible about the given object
mp_print_str(MP_PYTHON_PRINTER, "object ");
mp_obj_print(obj, PRINT_STR);
- mp_printf(MP_PYTHON_PRINTER, " is of type %s\n", mp_obj_get_type_str(obj));
+ mp_printf(MP_PYTHON_PRINTER, " is of type %q\n", type->name);
mp_map_t *map = NULL;
- if (MP_OBJ_IS_TYPE(obj, &mp_type_module)) {
+ if (type == &mp_type_module) {
map = mp_obj_dict_get_map(mp_obj_module_get_globals(obj));
} else {
- mp_obj_type_t *type;
- if (MP_OBJ_IS_TYPE(obj, &mp_type_type)) {
- type = obj;
- } else {
- type = mp_obj_get_type(obj);
+ if (type == &mp_type_type) {
+ type = MP_OBJ_TO_PTR(obj);
}
if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &mp_type_dict)) {
map = mp_obj_dict_get_map(type->locals_dict);