ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: ko1@atdot•net
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50622] [Ruby trunk Bug#14817] TracePoint#parameters for bmethod's return event should return the same value as its Method#parameters
Date: Thu, 23 Aug 2018 07:10:51 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-73669.20180823071050.625a68cccd740c5d@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14817.20180603144747@ruby-lang.org

Issue #14817 has been updated by ko1 (Koichi Sasada).


見逃してました。

これ、実装見てたら、どーしょーもない気がするんで、制限のある仕様、ってことで駄目でしょうか。駄目かなあ。実装アイディア募集。

----------------------------------------
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-73669

* Author: ktsj (Kazuki Tsujimoto)
* Status: Assigned
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* 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/

  parent reply	other threads:[~2018-08-23  7:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14817.20180603144747@ruby-lang.org>
2018-06-03 14:47 ` [ruby-dev:50558] [Ruby trunk Bug#14817] TracePoint#parameters for bmethod's return event should return the same value as its Method#parameters kazuki
2018-06-03 22:54 ` [ruby-dev:50559] " mame
2018-06-03 23:00 ` [ruby-dev:50560] " mame
2018-08-23  7:10 ` ko1 [this message]
2018-12-10  6:48 ` [ruby-dev:50689] " ko1
2019-07-15  2:51 ` [ruby-dev:50815] [Ruby master " ko1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-73669.20180823071050.625a68cccd740c5d@ruby-lang.org \
    --to=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).