Issue #14817 has been updated by mame (Yusuke Endoh).


TracePoint#parameters の問題ではなく、define_method + TracePoint 全般の問題のようです。

```
define_method(:bm) {|a|}

trace = TracePoint.new(:call, :return){|tp|
  p [tp.event, tp.lineno] if tp.method_id == :bm
}
trace.enable{
  bm(0)
}
```

```
$ ./miniruby test.rb
[:call, 1]
[:return, 7] #=> [:return, 1] になるべき?
```

----------------------------------------
Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parameters
https://bugs.ruby-lang.org/issues/14817#change-72354

* Author: ktsj (Kazuki Tsujimoto)
* Status: Assigned
* Priority: Normal
* Assignee: mame (Yusuke Endoh)
* Target version: 2.6
* ruby -v: ruby 2.6.0dev (2018-06-03 master 63562) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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イベント時も同様となるべきだと思います。




-- 
https://bugs.ruby-lang.org/