[前][次][番号順一覧][スレッド一覧]

ruby-changes:5068

From: matz <ko1@a...>
Date: Sat, 24 May 2008 09:43:39 +0900 (JST)
Subject: [ruby-changes:5068] Ruby:r16563 (ruby_1_8): * error.c (syserr_eqq): === should be able to handle delegated

matz	2008-05-24 09:25:36 +0900 (Sat, 24 May 2008)

  New Revision: 16563

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/error.c
    branches/ruby_1_8/version.h

  Log:
    * error.c (syserr_eqq): === should be able to handle delegated
      objects as well.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/error.c?r1=16563&r2=16562&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16563&r2=16562&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=16563&r2=16562&diff_format=u

Index: ruby_1_8/error.c
===================================================================
--- ruby_1_8/error.c	(revision 16562)
+++ ruby_1_8/error.c	(revision 16563)
@@ -952,18 +952,16 @@
     VALUE self, 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(klass)->super;
-	}
-	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))
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 16562)
+++ ruby_1_8/ChangeLog	(revision 16563)
@@ -18,6 +18,11 @@
 
 	* ext/extmk.rb: load purelib.rb only when not cross compiling.
 
+Fri May 23 08:47:02 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* error.c (syserr_eqq): === should be able to handle delegated
+	  objects as well.
+
 Fri May 23 04:22:19 2008  Hidetoshi NAGAI  <nagai@a...>
 
 	* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 16562)
+++ ruby_1_8/version.h	(revision 16563)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2008-05-23"
+#define RUBY_RELEASE_DATE "2008-05-24"
 #define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20080523
+#define RUBY_RELEASE_CODE 20080524
 #define RUBY_PATCHLEVEL 5000
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 7
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 23
+#define RUBY_RELEASE_DAY 24
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]