mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
encoding.c: check external encoding
* encoding.c (rb_enc_get_index): external encoding may not be Data object. [ruby-core:89016] [Bug #15122] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
97f8d0fb9e
commit
e040465153
2 changed files with 8 additions and 1 deletions
|
@ -803,7 +803,7 @@ rb_enc_get_index(VALUE obj)
|
|||
if (NIL_P(tmp)) {
|
||||
tmp = rb_funcallv(obj, rb_intern("external_encoding"), 0, 0);
|
||||
}
|
||||
if (is_data_encoding(tmp)) {
|
||||
if (is_obj_encoding(tmp)) {
|
||||
i = enc_check_encoding(tmp);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -3855,4 +3855,11 @@ __END__
|
|||
th.join
|
||||
end;
|
||||
end
|
||||
|
||||
def test_external_encoding_index
|
||||
IO.pipe {|r, w|
|
||||
assert_raise(TypeError) {Marshal.dump(r)}
|
||||
assert_raise(TypeError) {Marshal.dump(w)}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue