summaryrefslogtreecommitdiffhomepage
path: root/src/object.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-03-02 15:45:15 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-03-02 15:45:15 +0900
commit73091ab20288d196e774cefd234660e5c6fefc14 (patch)
tree83131406133a0d4c48bbe6f7ba2c37b7f8e8bee9 /src/object.c
parentca0dcbb22662eda2f6843cca14256c57cbd585e4 (diff)
downloadmruby-73091ab20288d196e774cefd234660e5c6fefc14.tar.gz
mruby-73091ab20288d196e774cefd234660e5c6fefc14.zip
Do not apply `mrb_ptr()` to immediate objects; fix #4307
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index b764fc8ef..d45ab27c7 100644
--- a/src/object.c
+++ b/src/object.c
@@ -434,8 +434,10 @@ mrb_any_to_s(mrb_state *mrb, mrb_value obj)
mrb_str_cat_lit(mrb, str, "#<");
mrb_str_cat_cstr(mrb, str, cname);
- mrb_str_cat_lit(mrb, str, ":");
- mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj)));
+ if (!mrb_immediate_p(obj)) {
+ mrb_str_cat_lit(mrb, str, ":");
+ mrb_str_concat(mrb, str, mrb_ptr_to_str(mrb, mrb_ptr(obj)));
+ }
mrb_str_cat_lit(mrb, str, ">");
return str;