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

ruby-changes:29154

From: nobu <ko1@a...>
Date: Mon, 10 Jun 2013 15:36:17 +0900 (JST)
Subject: [ruby-changes:29154] nobu:r41206 (trunk): eval_error.c: use checking functions

nobu	2013-06-10 15:36:02 +0900 (Mon, 10 Jun 2013)

  New Revision: 41206

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41206

  Log:
    eval_error.c: use checking functions
    
    * eval_error.c (error_print): use checking functions instead of
      catching exceptions.

  Modified files:
    trunk/ChangeLog
    trunk/eval_error.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41205)
+++ ChangeLog	(revision 41206)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Mon Jun 10 15:35:34 2013  Nobuyoshi Nakada  <nobu@r...>
+Mon Jun 10 15:36:00 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_error.c (error_print): use checking functions instead of
+	  catching exceptions.
 
 	* eval_error.c (error_print): restore errinfo for the case new
 	  excecption raised while printing the message.  [ruby-core:55365]
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 41205)
+++ eval_error.c	(revision 41206)
@@ -127,9 +127,9 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L127
     }
 
     eclass = CLASS_OF(errinfo);
-    if (eclass != Qundef) {
-	e = rb_funcall(errinfo, rb_intern("message"), 0, 0);
-	StringValue(e);
+    if (eclass != Qundef &&
+	(e = rb_check_funcall(errinfo, rb_intern("message"), 0, 0)) != Qundef &&
+	(RB_TYPE_P(e, T_STRING) || !NIL_P(e = rb_check_string_type(e)))) {
 	einfo = RSTRING_PTR(e);
 	elen = RSTRING_LEN(e);
     }

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

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