Skip to content

Commit 8c70523

Browse files
committed
py: Fix mp_obj_print() to work when Python streams are not used.
1 parent 1f91e92 commit 8c70523

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

py/obj.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,16 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e
7272
}
7373

7474
void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) {
75+
#if MICROPY_PY_IO
7576
// defined per port; type of these is irrelevant, just need pointer
7677
extern mp_uint_t mp_sys_stdout_obj;
77-
7878
pfenv_t pfenv;
7979
pfenv.data = &mp_sys_stdout_obj;
8080
pfenv.print_strn = (void (*)(void *, const char *, mp_uint_t))mp_stream_write;
81-
8281
mp_obj_print_helper((void (*)(void *env, const char *fmt, ...))pfenv_printf, &pfenv, o_in, kind);
82+
#else
83+
mp_obj_print_helper(printf_wrapper, NULL, o_in, kind);
84+
#endif
8385
}
8486

8587
// helper function to print an exception with traceback

0 commit comments

Comments
 (0)