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

ruby-changes:34155

From: nagachika <ko1@a...>
Date: Fri, 30 May 2014 00:19:14 +0900 (JST)
Subject: [ruby-changes:34155] nagachika:r46236 (ruby_2_1): merge revision(s) r45178, r45180, r45183: [Backport #9568]

nagachika	2014-05-30 00:19:03 +0900 (Fri, 30 May 2014)

  New Revision: 46236

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

  Log:
    merge revision(s) r45178,r45180,r45183: [Backport #9568]
    
    eval.c: remove unneeded GC guard
    
    * eval.c (setup_exception): remove RB_GC_GUARD which is no longer
      needed since r41598.
    * eval.c (setup_exception): preserve errinfo across calling #to_s
      method on the exception.  [ruby-core:61091] [Bug #9568]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/eval.c
    branches/ruby_2_1/test/ruby/test_exception.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46235)
+++ ruby_2_1/ChangeLog	(revision 46236)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Fri May 30 00:13:19 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (setup_exception): preserve errinfo across calling #to_s
+	  method on the exception.  [ruby-core:61091] [Bug #9568]
+
 Thu May 29 20:57:59 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* numeric.c (ruby_num_interval_step_size): check signs and get rid
Index: ruby_2_1/eval.c
===================================================================
--- ruby_2_1/eval.c	(revision 46235)
+++ ruby_2_1/eval.c	(revision 46236)
@@ -507,9 +507,12 @@ setup_exception(rb_thread_t *th, int tag https://github.com/ruby/ruby/blob/trunk/ruby_2_1/eval.c#L507
 	!rb_obj_is_kind_of(e, rb_eSystemExit)) {
 	int status;
 
+	mesg = e;
 	PUSH_TAG();
 	if ((status = EXEC_TAG()) == 0) {
-	    RB_GC_GUARD(e) = rb_obj_as_string(e);
+	    th->errinfo = Qnil;
+	    e = rb_obj_as_string(mesg);
+	    th->errinfo = mesg;
 	    if (file && line) {
 		warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
 			    rb_obj_classname(th->errinfo), file, line, e);
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46235)
+++ ruby_2_1/version.h	(revision 46236)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
-#define RUBY_RELEASE_DATE "2014-05-29"
-#define RUBY_PATCHLEVEL 116
+#define RUBY_RELEASE_DATE "2014-05-30"
+#define RUBY_PATCHLEVEL 117
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 29
+#define RUBY_RELEASE_DAY 30
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/ruby/test_exception.rb
===================================================================
--- ruby_2_1/test/ruby/test_exception.rb	(revision 46235)
+++ ruby_2_1/test/ruby/test_exception.rb	(revision 46236)
@@ -78,6 +78,28 @@ class TestException < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_exception.rb#L78
     assert(!bad)
   end
 
+  def test_errinfo_in_debug
+    bug9568 = EnvUtil.labeled_class("[ruby-core:61091] [Bug #9568]", RuntimeError) do
+      def to_s
+        require '\0'
+      rescue LoadError
+        self.class.to_s
+      end
+    end
+
+    err = EnvUtil.verbose_warning do
+      assert_raise(bug9568) do
+        $DEBUG, debug = true, $DEBUG
+        begin
+          raise bug9568
+        ensure
+          $DEBUG = debug
+        end
+      end
+    end
+    assert_include(err, bug9568.to_s)
+  end
+
   def test_break_ensure
     bad = true
     while true

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r45178,45180,45183


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

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