From 370212a8ae39939979cf0651bd98108316a8e535 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 19 Jun 2014 10:49:46 +0000 Subject: * vm.c (invoke_block_from_c): move call/return event timing for bmethod. It can invoke inconsistent call event if this call raises argument error. [Bug #9959] * vm_insnhelper.c (vm_call_bmethod_body): ditto. * test/ruby/test_settracefunc.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_settracefunc.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/ruby/test_settracefunc.rb') diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 72e114398b..0c8d7399cc 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -383,7 +383,7 @@ class TestSetTraceFunc < Test::Unit::TestCase [["c-return", 3, :set_trace_func, Kernel], ["line", 6, __method__, self.class], - ["call", 6, :foobar, FooBar], + ["call", 1, :foobar, FooBar], ["return", 6, :foobar, FooBar], ["line", 7, __method__, self.class], ["c-call", 7, :set_trace_func, Kernel]].each{|e| @@ -1238,4 +1238,23 @@ class TestSetTraceFunc < Test::Unit::TestCase trace.disable end end + + define_method(:method_test_argument_error_on_bmethod){|correct_key: 1|} + + def test_argument_error_on_bmethod + events = [] + curr_thread = Thread.current + TracePoint.new(:call, :return){|tp| + next if curr_thread != Thread.current + events << [tp.event, tp.method_id] + }.enable do + begin + method_test_argument_error_on_bmethod(wrong_key: 2) + rescue => e + # ignore + end + end + + assert_equal [], events # should be empty. + end end -- cgit v1.2.3