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

ruby-changes:53338

From: naruse <ko1@a...>
Date: Tue, 6 Nov 2018 08:06:54 +0900 (JST)
Subject: [ruby-changes:53338] naruse:r65554 (trunk): Don't set throw data as cause [Bug #15282]

naruse	2018-11-06 08:06:50 +0900 (Tue, 06 Nov 2018)

  New Revision: 65554

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

  Log:
    Don't set throw data as cause [Bug #15282]

  Modified files:
    trunk/eval.c
    trunk/test/ruby/test_exception.rb
Index: eval.c
===================================================================
--- eval.c	(revision 65553)
+++ eval.c	(revision 65554)
@@ -531,7 +531,7 @@ setup_exception(rb_execution_context_t * https://github.com/ruby/ruby/blob/trunk/eval.c#L531
 		    mesg = rb_obj_dup(mesg);
 		}
 	    }
-	    if (cause != Qundef) {
+	    if (cause != Qundef && !THROW_DATA_P(cause)) {
 		exc_setup_cause(mesg, cause);
 	    }
 	    if (NIL_P(bt)) {
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 65553)
+++ test/ruby/test_exception.rb	(revision 65554)
@@ -699,6 +699,12 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L699
     assert_same(a, e.cause.cause)
   end
 
+  def test_cause_at_end
+    assert_in_out_err([], <<-'end;', [], [/-: unexpected return\n/, /.*undefined local variable or method `n'.*\n/])
+      END{n}; END{return}
+    end;
+  end
+
   def test_raise_with_cause
     msg = "[Feature #8257]"
     cause = ArgumentError.new("foobar")

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

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