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
@ -803,7 +803,7 @@ rb_enc_get_index(VALUE obj)
|
|||||||
if (NIL_P(tmp)) {
|
if (NIL_P(tmp)) {
|
||||||
tmp = rb_funcallv(obj, rb_intern("external_encoding"), 0, 0);
|
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);
|
i = enc_check_encoding(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3855,4 +3855,11 @@ __END__
|
|||||||
th.join
|
th.join
|
||||||
end;
|
end;
|
||||||
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user