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

ruby-changes:13870

From: nobu <ko1@a...>
Date: Fri, 6 Nov 2009 11:01:49 +0900 (JST)
Subject: [ruby-changes:13870] Ruby:r25670 (ruby_1_8): * eval.c (call_trace_func): remove the trace hook if any exception

nobu	2009-11-06 11:01:36 +0900 (Fri, 06 Nov 2009)

  New Revision: 25670

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

  Log:
    * eval.c (call_trace_func): remove the trace hook if any exception
      raised.  [ruby-list:46515]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/eval.c
    branches/ruby_1_8/test/ruby/test_settracefunc.rb

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 25669)
+++ ruby_1_8/ChangeLog	(revision 25670)
@@ -1,3 +1,8 @@
+Fri Nov  6 11:01:34 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (call_trace_func): remove the trace hook if any exception
+	  raised.  [ruby-list:46515]
+
 Fri Nov  6 10:56:21 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* eval.c (get_event_name): added thread events.
Index: ruby_1_8/test/ruby/test_settracefunc.rb
===================================================================
--- ruby_1_8/test/ruby/test_settracefunc.rb	(revision 25669)
+++ ruby_1_8/test/ruby/test_settracefunc.rb	(revision 25670)
@@ -135,4 +135,9 @@
     assert_equal(["c-call", 131, :set_trace_func, Kernel], events.shift)
     assert_equal([], events)
   end
+
+  def test_bad_trace
+    e = Class.new(RuntimeError)
+    assert_raise(e) {set_trace_func proc{raise e}}
+  end
 end
Index: ruby_1_8/eval.c
===================================================================
--- ruby_1_8/eval.c	(revision 25669)
+++ ruby_1_8/eval.c	(revision 25670)
@@ -2828,7 +2828,11 @@
     tracing = 0;
     ruby_current_node = node_save;
     SET_CURRENT_SOURCE();
-    if (state) JUMP_TAG(state);
+    if (state) {
+	trace_func = 0;
+	rb_remove_event_hook(call_trace_func);
+	JUMP_TAG(state);
+    }
 }
 
 static VALUE

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

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