summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-02-17 00:32:18 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-02-17 00:32:18 +0200
commit8c705233f3bb335a5531cc397b794a7537b9daf7 (patch)
tree6b892d9e9cceaae56363306bc3c7817befcab9ca /py
parent1f91e92cc6774b79ea59643bb4ab27c1d33bda3a (diff)
downloadmicropython-8c705233f3bb335a5531cc397b794a7537b9daf7.tar.gz
micropython-8c705233f3bb335a5531cc397b794a7537b9daf7.zip
py: Fix mp_obj_print() to work when Python streams are not used.
Diffstat (limited to 'py')
-rw-r--r--py/obj.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/py/obj.c b/py/obj.c
index dad27b8772..c376adc03c 100644
--- a/py/obj.c
+++ b/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