ruby-changes:48323
From: marcandre <ko1@a...>
Date: Thu, 26 Oct 2017 15:58:14 +0900 (JST)
Subject: [ruby-changes:48323] marcandRe: r60437 (trunk): TracePoint#enable, #disable: Don't yield any argument. [Bug #14057]
marcandre 2017-10-26 15:58:09 +0900 (Thu, 26 Oct 2017) New Revision: 60437 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60437 Log: TracePoint#enable, #disable: Don't yield any argument. [Bug #14057] Modified files: trunk/test/ruby/test_settracefunc.rb trunk/vm_trace.c Index: test/ruby/test_settracefunc.rb =================================================================== --- test/ruby/test_settracefunc.rb (revision 60436) +++ test/ruby/test_settracefunc.rb (revision 60437) @@ -639,16 +639,19 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L639 def test_tracepoint_enable ary = [] + args = nil trace = TracePoint.new(:call){|tp| next if !target_thread? ary << tp.method_id } foo - trace.enable{ + trace.enable{|*a| + args = a foo } foo assert_equal([:foo], ary) + assert_equal([], args) trace = TracePoint.new{} begin @@ -663,17 +666,20 @@ class TestSetTraceFunc < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L666 def test_tracepoint_disable ary = [] + args = nil trace = TracePoint.trace(:call){|tp| next if !target_thread? ary << tp.method_id } foo - trace.disable{ + trace.disable{|*a| + args = a foo } foo trace.disable assert_equal([:foo, :foo], ary) + assert_equal([], args) trace = TracePoint.new{} trace.enable{ Index: vm_trace.c =================================================================== --- vm_trace.c (revision 60436) +++ vm_trace.c (revision 60437) @@ -1088,7 +1088,7 @@ tracepoint_enable_m(VALUE tpval) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1088 rb_tracepoint_enable(tpval); if (rb_block_given_p()) { - return rb_ensure(rb_yield, Qnil, + return rb_ensure(rb_yield, Qundef, previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable, tpval); } @@ -1139,7 +1139,7 @@ tracepoint_disable_m(VALUE tpval) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1139 rb_tracepoint_disable(tpval); if (rb_block_given_p()) { - return rb_ensure(rb_yield, Qnil, + return rb_ensure(rb_yield, Qundef, previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable, tpval); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/