Commit 8c705233 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py: Fix mp_obj_print() to work when Python streams are not used.

parent 1f91e92c
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment