diff --git a/ChangeLog b/ChangeLog index 4003a6ad4b..7ef4616fe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Jul 22 02:22:45 2003 Yukihiro Matsumoto + + * string.c (rb_str_equal): should return nil for non string + operand to conform comparable convention. [ruby-dev:20759] + + * object.c (rb_equal): preserve nil if "==" returns nil. + Tue Jul 22 00:19:19 2003 Yukihiro Matsumoto * lib/tmpdir.rb: new library to get temporary directory path, diff --git a/object.c b/object.c index 7e8b5e68e1..e168fa7505 100644 --- a/object.c +++ b/object.c @@ -42,7 +42,7 @@ rb_equal(obj1, obj2) if (obj1 == obj2) return Qtrue; result = rb_funcall(obj1, id_eq, 1, obj2); if (RTEST(result)) return Qtrue; - return Qfalse; + return result; } int diff --git a/string.c b/string.c index fc1e66cb26..c7b5ddd9f2 100644 --- a/string.c +++ b/string.c @@ -792,7 +792,7 @@ rb_str_equal(str1, str2) if (str1 == str2) return Qtrue; if (TYPE(str2) != T_STRING) { if (!rb_respond_to(str2, rb_intern("to_str"))) { - return Qfalse; + return Qnil; } return rb_equal(str2, str1); }