diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-23 21:12:32 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-23 21:12:32 +0000 |
commit | 938d8f31f3e517354362427fbcf9fb61f0705358 (patch) | |
tree | 2fef5a29300a1f0c8b40872d79c2527364efbea4 /encoding.c | |
parent | fe5c4b95bf262ab8e1616c6eb14b0a3152730b7d (diff) | |
download | ruby-938d8f31f3e517354362427fbcf9fb61f0705358.tar.gz ruby-938d8f31f3e517354362427fbcf9fb61f0705358.tar.xz ruby-938d8f31f3e517354362427fbcf9fb61f0705358.zip |
* encoding.c (enc_compatible_p): raise TypeError when argument is Encoding.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c index 9002a1f17..5e8412a02 100644 --- a/encoding.c +++ b/encoding.c @@ -876,6 +876,8 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2) { rb_encoding *enc; + if (enc_check_encoding(str1) > 0 || enc_check_encoding(str2) > 0) + rb_raise(rb_eTypeError, "wrong argument type Encoding (expected String)"); if (!enc_capable(str1)) return Qnil; if (!enc_capable(str2)) return Qnil; enc = rb_enc_compatible(str1, str2); |