ruby-changes:5077
From: matz <ko1@a...>
Date: Sat, 24 May 2008 22:40:12 +0900 (JST)
Subject: [ruby-changes:5077] Ruby:r16572 (trunk): * error.c (exc_equal): == operator should be transitional.
matz 2008-05-24 22:39:57 +0900 (Sat, 24 May 2008)
New Revision: 16572
Modified files:
trunk/ChangeLog
trunk/error.c
Log:
* error.c (exc_equal): == operator should be transitional.
[ruby-dev:34808]
* error.c (syserr_eqq): === should be able to handle delegated
objects as well.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16572&r2=16571&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/error.c?r1=16572&r2=16571&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16571)
+++ ChangeLog (revision 16572)
@@ -34,6 +34,14 @@
tool/instruction.rb (RubyVM::VmBodyGenerator#make_header_operands):
omit unused variables.
+Fri May 23 08:47:02 2008 Yukihiro Matsumoto <matz@r...>
+
+ * error.c (exc_equal): == operator should be transitional.
+ [ruby-dev:34808]
+
+ * error.c (syserr_eqq): === should be able to handle delegated
+ objects as well.
+
Fri May 23 06:15:20 2008 Nobuyoshi Nakada <nobu@r...>
* iseq.c (rb_iseq_compile_with_option): get rid of segv.
Index: error.c
===================================================================
--- error.c (revision 16571)
+++ error.c (revision 16572)
@@ -556,7 +556,7 @@
if (exc == obj) return Qtrue;
if (rb_obj_class(exc) != rb_obj_class(obj))
- return Qfalse;
+ return rb_equal(obj, exc);
if (!rb_equal(rb_attr_get(exc, id_mesg), rb_attr_get(obj, id_mesg)))
return Qfalse;
if (!rb_equal(exc_backtrace(exc), exc_backtrace(obj)))
@@ -963,18 +963,16 @@
syserr_eqq(VALUE self, VALUE exc)
{
VALUE num, e;
+ ID en = rb_intern("errno");
- if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
- if (self == rb_eSystemCallError) return Qtrue;
+ if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
+ if (!rb_respond_to(exc, en)) return Qfalse;
+ }
+ else if (self == rb_eSystemCallError) return Qtrue;
num = rb_attr_get(exc, rb_intern("errno"));
if (NIL_P(num)) {
- VALUE klass = CLASS_OF(exc);
-
- while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
- klass = (VALUE)RCLASS_SUPER(klass);
- }
- num = rb_const_get(klass, rb_intern("Errno"));
+ num = rb_funcall(exc, en, 0, 0);
}
e = rb_const_get(self, rb_intern("Errno"));
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/