diff --git a/ChangeLog b/ChangeLog index 67623aa8e0..0ce7d50223 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 11 07:39:44 2006 Yukihiro Matsumoto + + * string.c (sym_equal): "sym == str" should compare them as + strings. [ruby-dev:29554] + Sun Sep 10 22:59:43 2006 Nobuyoshi Nakada * instruby.rb (parse_args): remove splat. diff --git a/string.c b/string.c index dc389b16fb..094907fe54 100644 --- a/string.c +++ b/string.c @@ -120,6 +120,7 @@ str_alloc(VALUE klass) OBJSETUP(str, klass, T_STRING); if (klass == rb_cSymbol) { + /* need to be registered in table */ RBASIC(str)->klass = rb_cString; } str->as.heap.ptr = 0; @@ -4429,15 +4430,16 @@ rb_sym_s_intern(VALUE s) * sym == obj => true or false * * Equality---If sym and obj are exactly the same - * symbol, returns true. Otherwise, returns - * false. + * symbol, returns true. Otherwise, compares them + * as strings. */ static VALUE sym_equal(VALUE sym1, VALUE sym2) { if (sym1 == sym2) return Qtrue; - return Qfalse; + if (SYMBOL_P(sym2)) return Qfalse; + return rb_str_equal(sym1, sym2); } /*