diff --git a/ChangeLog b/ChangeLog index b9f73f9232..7a2ed0738b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Aug 3 07:46:30 2011 Nobuyoshi Nakada + + * encoding.c (enc_find): mistakenly remained !. [Bug #5150] + Wed Aug 3 00:11:08 2011 Tanaka Akira * lib/prettyprint.rb: update document. [ruby-core:36776] diff --git a/encoding.c b/encoding.c index 8e80e8ce66..e5bc75b4ef 100644 --- a/encoding.c +++ b/encoding.c @@ -1054,7 +1054,7 @@ static VALUE enc_find(VALUE klass, VALUE enc) { int idx; - if (!SPECIAL_CONST_P(enc) && BUILTIN_TYPE(enc) == T_DATA && is_data_encoding(enc)) + if (RB_TYPE_P(enc, T_DATA) && is_data_encoding(enc)) return enc; idx = str_to_encindex(enc); if (idx == UNSPECIFIED_ENCODING) return Qnil; diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb index 6ddac1d51a..c1c50a5dfa 100644 --- a/test/ruby/test_encoding.rb +++ b/test/ruby/test_encoding.rb @@ -50,6 +50,9 @@ class TestEncoding < Test::Unit::TestCase exit Encoding.find("filesystem") == Encoding::EUC_JP EOS end + + bug5150 = '[ruby-dev:44327]' + assert_raise(TypeError, bug5150) {Encoding.find(1)} end def test_replicate