summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--marshal.c4
-rw-r--r--test/ruby/test_marshal.rb7
2 files changed, 9 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index 1fae545..b38c53c 100644
--- a/marshal.c
+++ b/marshal.c
@@ -904,8 +904,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
break;
default:
- rb_raise(rb_eTypeError, "can't dump %s",
- rb_obj_classname(obj));
+ rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE,
+ rb_obj_class(obj));
break;
}
RB_GC_GUARD(obj);
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 3d5d6c9..c8d79ed 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -647,4 +647,11 @@ class TestMarshal < Test::Unit::TestCase
c.cc.call
end
end
+
+ def test_undumpable_message
+ c = Module.new {break module_eval("class IO\u{26a1} < IO;self;end")}
+ assert_raise_with_message(TypeError, /IO\u{26a1}/) {
+ Marshal.dump(c.new(0, autoclose: false))
+ }
+ end
end