summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/print.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index 6c561100f..b43936b13 100644
--- a/src/print.c
+++ b/src/print.c
@@ -27,8 +27,13 @@ MRB_API void
mrb_p(mrb_state *mrb, mrb_value obj)
{
#ifdef ENABLE_STDIO
- obj = mrb_funcall(mrb, obj, "inspect", 0);
- printstr(mrb, obj);
+ mrb_value val;
+
+ val = mrb_funcall(mrb, obj, "inspect", 0);
+ if (!mrb_string_p(val)) {
+ val = mrb_obj_as_string(mrb, obj);
+ }
+ printstr(mrb, val);
putc('\n', stdout);
#endif
}