py: Fix mp_obj_print() to work when Python streams are not used.
This commit is contained in:
parent
1f91e92cc6
commit
8c705233f3
6
py/obj.c
6
py/obj.c
@ -72,14 +72,16 @@ void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *e
|
||||
}
|
||||
|
||||
void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) {
|
||||
#if MICROPY_PY_IO
|
||||
// defined per port; type of these is irrelevant, just need pointer
|
||||
extern mp_uint_t mp_sys_stdout_obj;
|
||||
|
||||
pfenv_t pfenv;
|
||||
pfenv.data = &mp_sys_stdout_obj;
|
||||
pfenv.print_strn = (void (*)(void *, const char *, mp_uint_t))mp_stream_write;
|
||||
|
||||
mp_obj_print_helper((void (*)(void *env, const char *fmt, ...))pfenv_printf, &pfenv, o_in, kind);
|
||||
#else
|
||||
mp_obj_print_helper(printf_wrapper, NULL, o_in, kind);
|
||||
#endif
|
||||
}
|
||||
|
||||
// helper function to print an exception with traceback
|
||||
|
Loading…
Reference in New Issue
Block a user