mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
marshal.c: class name encoding
* marshal.c (w_object): preserve the encoding of the class name in an error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c5e9beac25
commit
2c1c5570e8
2 changed files with 9 additions and 2 deletions
|
@ -904,8 +904,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rb_raise(rb_eTypeError, "can't dump %s",
|
rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE,
|
||||||
rb_obj_classname(obj));
|
rb_obj_class(obj));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
RB_GC_GUARD(obj);
|
RB_GC_GUARD(obj);
|
||||||
|
|
|
@ -647,4 +647,11 @@ class TestMarshal < Test::Unit::TestCase
|
||||||
c.cc.call
|
c.cc.call
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue