summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--py/emitglue.c3
-rw-r--r--py/gc.c3
-rw-r--r--py/map.c8
-rw-r--r--py/objfun.c2
-rw-r--r--py/objtype.c11
5 files changed, 17 insertions, 10 deletions
diff --git a/py/emitglue.c b/py/emitglue.c
index a7fff0e0eb..f75a57437f 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -76,6 +76,9 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code,
#endif
#ifdef DEBUG_PRINT
+ #if !MICROPY_DEBUG_PRINTERS
+ const size_t len = 0;
+ #endif
DEBUG_printf("assign byte code: code=%p len=" UINT_FMT " flags=%x\n", code, len, (uint)scope_flags);
#endif
#if MICROPY_DEBUG_PRINTERS
diff --git a/py/gc.c b/py/gc.c
index 0fc43ef495..4f5793bf51 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -910,7 +910,8 @@ void gc_dump_alloc_table(void) {
GC_EXIT();
}
-#if DEBUG_PRINT
+#if 0
+// For testing the GC functions
void gc_test(void) {
mp_uint_t len = 500;
mp_uint_t *heap = malloc(len);
diff --git a/py/map.c b/py/map.c
index 6abf4853f1..fc5e1b1b75 100644
--- a/py/map.c
+++ b/py/map.c
@@ -423,13 +423,13 @@ void mp_set_clear(mp_set_t *set) {
#if defined(DEBUG_PRINT) && DEBUG_PRINT
void mp_map_dump(mp_map_t *map) {
for (size_t i = 0; i < map->alloc; i++) {
- if (map->table[i].key != NULL) {
+ if (map->table[i].key != MP_OBJ_NULL) {
mp_obj_print(map->table[i].key, PRINT_REPR);
} else {
- printf("(nil)");
+ DEBUG_printf("(nil)");
}
- printf(": %p\n", map->table[i].value);
+ DEBUG_printf(": %p\n", map->table[i].value);
}
- printf("---\n");
+ DEBUG_printf("---\n");
}
#endif
diff --git a/py/objfun.c b/py/objfun.c
index b8657ec954..df377441e0 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -257,8 +257,8 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const
dump_args(args, n_args);
DEBUG_printf("Input kw args: ");
dump_args(args + n_args, n_kw * 2);
+
mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in);
- DEBUG_printf("Func n_def_args: %d\n", self->n_def_args);
size_t n_state, state_size;
DECODE_CODESTATE_SIZE(self->bytecode, n_state, state_size);
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;
}