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

ruby-changes:42695

From: usa <ko1@a...>
Date: Tue, 26 Apr 2016 12:21:06 +0900 (JST)
Subject: [ruby-changes:42695] usa:r54769 (ruby_2_2): merge revision(s) 54681: [Backport #12302]

usa	2016-04-26 13:17:39 +0900 (Tue, 26 Apr 2016)

  New Revision: 54769

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

  Log:
    merge revision(s) 54681: [Backport #12302]
    
    * eval_jump.c (exec_end_procs_chain): restore previous error info
      for each end procs.  [ruby-core:75038] [Bug #12302]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/eval_jump.c
    branches/ruby_2_2/test/ruby/test_beginendblock.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 54768)
+++ ruby_2_2/version.h	(revision 54769)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.5"
-#define RUBY_RELEASE_DATE "2016-04-22"
-#define RUBY_PATCHLEVEL 314
+#define RUBY_RELEASE_DATE "2016-04-26"
+#define RUBY_PATCHLEVEL 315
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 22
+#define RUBY_RELEASE_DAY 26
 
 #include "ruby/version.h"
 
Index: ruby_2_2/test/ruby/test_beginendblock.rb
===================================================================
--- ruby_2_2/test/ruby/test_beginendblock.rb	(revision 54768)
+++ ruby_2_2/test/ruby/test_beginendblock.rb	(revision 54769)
@@ -187,4 +187,22 @@ at_exit { callcc {|_c| c = _c } } https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_beginendblock.rb#L187
 EOS
     assert_normal_exit(script, bug9110)
   end
+
+  def test_errinfo_at_exit
+    bug12302 = '[ruby-core:75038] [Bug #12302]'
+    assert_in_out_err([], <<-'end;', %w[2:exit 1:exit], [], bug12302)
+      at_exit do
+        puts "1:#{$!}"
+      end
+
+      at_exit do
+        puts "2:#{$!}"
+        raise 'x' rescue nil
+      end
+
+      at_exit do
+        exit
+      end
+    end;
+  end
 end
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 54768)
+++ ruby_2_2/ChangeLog	(revision 54769)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Tue Apr 26 13:16:41 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_jump.c (exec_end_procs_chain): restore previous error info
+	  for each end procs.  [ruby-core:75038] [Bug #12302]
+
 Fri Apr 22 18:36:15 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* compile.c (new_label_body): initialize bit fields, since
Index: ruby_2_2/eval_jump.c
===================================================================
--- ruby_2_2/eval_jump.c	(revision 54768)
+++ ruby_2_2/eval_jump.c	(revision 54769)
@@ -94,10 +94,11 @@ rb_mark_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/eval_jump.c#L94
 }
 
 static void
-exec_end_procs_chain(struct end_proc_data *volatile *procs)
+exec_end_procs_chain(struct end_proc_data *volatile *procs, VALUE *errp)
 {
     struct end_proc_data volatile endproc;
     struct end_proc_data *link;
+    VALUE errinfo = *errp;
 
     while ((link = *procs) != 0) {
 	*procs = link->next;
@@ -105,6 +106,7 @@ exec_end_procs_chain(struct end_proc_dat https://github.com/ruby/ruby/blob/trunk/ruby_2_2/eval_jump.c#L106
 	xfree(link);
 	rb_set_safe_level_force(endproc.safe);
 	(*endproc.func) (endproc.data);
+	*errp = errinfo;
     }
 }
 
@@ -119,8 +121,8 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/eval_jump.c#L121
     PUSH_TAG();
     if ((status = EXEC_TAG()) == 0) {
       again:
-	exec_end_procs_chain(&ephemeral_end_procs);
-	exec_end_procs_chain(&end_procs);
+	exec_end_procs_chain(&ephemeral_end_procs, &th->errinfo);
+	exec_end_procs_chain(&end_procs, &th->errinfo);
     }
     else {
 	VAR_INITIALIZED(th);

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r54681


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

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