mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 60437: [Backport #14057]
TracePoint#enable, #disable: Don't yield any argument. [Bug #14057] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
072ef48c5b
commit
acbf49de47
3 changed files with 13 additions and 7 deletions
|
@ -639,16 +639,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_tracepoint_enable
|
def test_tracepoint_enable
|
||||||
ary = []
|
ary = []
|
||||||
|
args = nil
|
||||||
trace = TracePoint.new(:call){|tp|
|
trace = TracePoint.new(:call){|tp|
|
||||||
next if !target_thread?
|
next if !target_thread?
|
||||||
ary << tp.method_id
|
ary << tp.method_id
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.enable{
|
trace.enable{|*a|
|
||||||
|
args = a
|
||||||
foo
|
foo
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
assert_equal([:foo], ary)
|
assert_equal([:foo], ary)
|
||||||
|
assert_equal([], args)
|
||||||
|
|
||||||
trace = TracePoint.new{}
|
trace = TracePoint.new{}
|
||||||
begin
|
begin
|
||||||
|
@ -663,17 +666,20 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_tracepoint_disable
|
def test_tracepoint_disable
|
||||||
ary = []
|
ary = []
|
||||||
|
args = nil
|
||||||
trace = TracePoint.trace(:call){|tp|
|
trace = TracePoint.trace(:call){|tp|
|
||||||
next if !target_thread?
|
next if !target_thread?
|
||||||
ary << tp.method_id
|
ary << tp.method_id
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.disable{
|
trace.disable{|*a|
|
||||||
|
args = a
|
||||||
foo
|
foo
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.disable
|
trace.disable
|
||||||
assert_equal([:foo, :foo], ary)
|
assert_equal([:foo, :foo], ary)
|
||||||
|
assert_equal([], args)
|
||||||
|
|
||||||
trace = TracePoint.new{}
|
trace = TracePoint.new{}
|
||||||
trace.enable{
|
trace.enable{
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#define RUBY_VERSION "2.4.4"
|
#define RUBY_VERSION "2.4.4"
|
||||||
#define RUBY_RELEASE_DATE "2018-03-07"
|
#define RUBY_RELEASE_DATE "2018-03-08"
|
||||||
#define RUBY_PATCHLEVEL 255
|
#define RUBY_PATCHLEVEL 256
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2018
|
#define RUBY_RELEASE_YEAR 2018
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
#define RUBY_RELEASE_DAY 7
|
#define RUBY_RELEASE_DAY 8
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ tracepoint_enable_m(VALUE tpval)
|
||||||
rb_tracepoint_enable(tpval);
|
rb_tracepoint_enable(tpval);
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
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,
|
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||||
tpval);
|
tpval);
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1154,7 @@ tracepoint_disable_m(VALUE tpval)
|
||||||
rb_tracepoint_disable(tpval);
|
rb_tracepoint_disable(tpval);
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
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,
|
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||||
tpval);
|
tpval);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue