summaryrefslogtreecommitdiffstatshomepage
path: root/py/objtype.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-08-02 14:17:24 +1000
committerDamien George <damien.p.george@gmail.com>2018-08-02 14:17:24 +1000
commitb630dfcc1dc027bd049b4af9d25180f82c4051d9 (patch)
tree30b3d17370dc50e85597dc7f9b4858c9ceb09ab8 /py/objtype.c
parentda2d2b6d884201f2cbb23f74c6c5557e30fb1f14 (diff)
downloadmicropython-b630dfcc1dc027bd049b4af9d25180f82c4051d9.tar.gz
micropython-b630dfcc1dc027bd049b4af9d25180f82c4051d9.zip
py: Fix compiling with debug enabled and make more use of DEBUG_printf.
DEBUG_printf and MICROPY_DEBUG_PRINTER is now used instead of normal printf, and a fault is fixed in mp_obj_class_lookup with debugging enabled; see issue #3999. Debugging can now be enabled on all ports including when nan-boxing is used.
Diffstat (limited to 'py/objtype.c')
-rw-r--r--py/objtype.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/py/objtype.c b/py/objtype.c
index ef70dfce0f..41f364b935 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -177,10 +177,13 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
mp_convert_member_lookup(obj_obj, type, elem->value, lookup->dest);
}
#if DEBUG_PRINT
- printf("mp_obj_class_lookup: Returning: ");
- mp_obj_print(lookup->dest[0], PRINT_REPR); printf(" ");
- // Don't try to repr() lookup->dest[1], as we can be called recursively
- printf("<%s @%p>\n", mp_obj_get_type_str(lookup->dest[1]), lookup->dest[1]);
+ DEBUG_printf("mp_obj_class_lookup: Returning: ");
+ mp_obj_print_helper(MICROPY_DEBUG_PRINTER, lookup->dest[0], PRINT_REPR);
+ if (lookup->dest[1] != MP_OBJ_NULL) {
+ // Don't try to repr() lookup->dest[1], as we can be called recursively
+ DEBUG_printf(" <%s @%p>", mp_obj_get_type_str(lookup->dest[1]), MP_OBJ_TO_PTR(lookup->dest[1]));
+ }
+ DEBUG_printf("\n");
#endif
return;
}