summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-29 22:50:16 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-29 22:50:16 +0000
commit5159f500fdab17c053075c7dd62b5050fdb80bc5 (patch)
treec56877dfff392f93b069071dcb06421d79da0749 /encoding.c
parent41d50725736df60e0118c337f8378b27497c7d94 (diff)
* encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.
* test/ruby/test_m17n.rb (test_compatible): fix test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/encoding.c b/encoding.c
index 21614245ae..bb6f5b269e 100644
--- a/encoding.c
+++ b/encoding.c
@@ -880,13 +880,15 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
{
rb_encoding *enc;
- if (BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
- rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
- rb_obj_classname(str1));
+ if (SPECIAL_CONST_P(str1) ||
+ BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
+ rb_obj_classname(str1));
}
- if (BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
- rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
- rb_obj_classname(str2));
+ if (SPECIAL_CONST_P(str2) ||
+ BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
+ rb_obj_classname(str2));
}
if (!enc_capable(str1)) return Qnil;
if (!enc_capable(str2)) return Qnil;