Project

General

Profile

Actions

Bug #14817

closed

TracePoint#parameters for bmethod's return event should return the same value as its Method#parameters

Added by ktsj (Kazuki Tsujimoto) over 6 years ago. Updated almost 3 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-06-03 master 63562) [x86_64-linux]
[ruby-dev:50558]

Description

define_methodしたメソッド(bmethod)のcall/returnイベント中にTracePoint#parametersを呼び出すと
以下の結果となります。

$ cat t.rb
define_method(:bm) {|a|}

p method_parameters: method(:bm).parameters

trace = TracePoint.new(:call, :return){|tp|
  mid = tp.method_id
  if mid == :bm
    p mid: mid, event: tp.event, tp_parameters: tp.parameters
  end
}
trace.enable{
  bm(0)
}

$ ruby -v t.rb
ruby 2.6.0dev (2018-06-03 master 63562) [x86_64-linux]
{:method_parameters=>[[:req, :a]]}
{:mid=>:bm, :event=>:call, :tp_parameters=>[[:req, :a]]}
{:mid=>:bm, :event=>:return, :tp_parameters=>[]}         #=> expected: {:mid=>:bm, :event=>:return, :tp_parameters=>[[:req, :a]]}

現状、callイベントに限ってその戻り値がbmethodのMethod#parametersの呼び出し結果と一致しますが
returnイベント時も同様となるべきだと思います。


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #13392: TracePoint return event location is incorrect for methods defined with define_methodClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0