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

ruby-changes:27326

From: usa <ko1@a...>
Date: Fri, 22 Feb 2013 14:28:46 +0900 (JST)
Subject: [ruby-changes:27326] usa:r39378 (ruby_1_9_3): merge revision(s) 34982: [Backport #5218]

usa	2013-02-22 14:28:36 +0900 (Fri, 22 Feb 2013)

  New Revision: 39378

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

  Log:
    merge revision(s) 34982: [Backport #5218]
    
    * eval_jump.c (rb_exec_end_proc): remember the latest exit status.
      [ruby-core:43173][Bug #5218]

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/eval_jump.c
    branches/ruby_1_9_3/test/ruby/test_beginendblock.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 39377)
+++ ruby_1_9_3/ChangeLog	(revision 39378)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Fri Feb 22 14:28:17 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval_jump.c (rb_exec_end_proc): remember the latest exit status.
+	  [ruby-core:43173][Bug #5218]
+
 Fri Feb 22 14:25:57 2013  NARUSE, Yui  <naruse@r...>
 
 	* ext/readline/readline.c (Init_readline): don't set 0 to
Index: ruby_1_9_3/eval_jump.c
===================================================================
--- ruby_1_9_3/eval_jump.c	(revision 39377)
+++ ruby_1_9_3/eval_jump.c	(revision 39378)
@@ -99,6 +99,8 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L99
     struct end_proc_data *volatile link;
     int status;
     volatile int safe = rb_safe_level();
+    rb_thread_t *th = GET_THREAD();
+    VALUE errinfo = th->errinfo;
 
     while (ephemeral_end_procs) {
 	link = ephemeral_end_procs;
@@ -112,6 +114,7 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L114
 	POP_TAG();
 	if (status) {
 	    error_handle(status);
+	    if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
 	}
 	xfree(link);
     }
@@ -128,10 +131,12 @@ rb_exec_end_proc(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/eval_jump.c#L131
 	POP_TAG();
 	if (status) {
 	    error_handle(status);
+	    if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
 	}
 	xfree(link);
     }
     rb_set_safe_level_force(safe);
+    th->errinfo = errinfo;
 }
 
 void
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 39377)
+++ ruby_1_9_3/version.h	(revision 39378)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 387
+#define RUBY_PATCHLEVEL 388
 
 #define RUBY_RELEASE_DATE "2013-02-22"
 #define RUBY_RELEASE_YEAR 2013
Index: ruby_1_9_3/test/ruby/test_beginendblock.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_beginendblock.rb	(revision 39377)
+++ ruby_1_9_3/test/ruby/test_beginendblock.rb	(revision 39378)
@@ -145,4 +145,17 @@ EOW https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_beginendblock.rb#L145
     assert_in_out_err(t.path, "", expected, [], "[ruby-core:35237]")
     t.close
   end
+
+  def test_rescue_at_exit
+    bug5218 = '[ruby-core:43173][Bug #5218]'
+    cmd = [
+      "raise 'X' rescue nil",
+      "nil",
+      "exit(42)",
+    ]
+    %w[at_exit END].each do |ex|
+      out, err, status = EnvUtil.invoke_ruby(cmd.map {|s|["-e", "#{ex} {#{s}}"]}.flatten, "", true, true)
+      assert_equal(["", "", 42], [out, err, status.exitstatus], "#{bug5218}: #{ex}")
+    end
+  end
 end

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r34982


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

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