diff options
-rw-r--r-- | test/ruby/test_settracefunc.rb | 10 | ||||
-rw-r--r-- | vm_trace.c | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index c5c914d0b0..15a8d8b98e 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -639,16 +639,19 @@ class TestSetTraceFunc < Test::Unit::TestCase 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::TestCase 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{ diff --git a/vm_trace.c b/vm_trace.c index 284950e08d..b03f0cc9d4 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1088,7 +1088,7 @@ tracepoint_enable_m(VALUE tpval) 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) 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); } |