https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112018-06-03T22:54:47ZRuby Issue Tracking SystemRuby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=723542018-06-03T22:54:47Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul></ul><p>TracePoint#parameters の問題ではなく、define_method + TracePoint 全般の問題のようです。</p>
<pre><code>define_method(:bm) {|a|}
trace = TracePoint.new(:call, :return){|tp|
p [tp.event, tp.lineno] if tp.method_id == :bm
}
trace.enable{
bm(0)
}
</code></pre>
<pre><code>$ ./miniruby test.rb
[:call, 1]
[:return, 7] #=> [:return, 1] になるべき?
</code></pre> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=723552018-06-03T23:00:35Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Assignee</strong> changed from <i>mame (Yusuke Endoh)</i> to <i>ko1 (Koichi Sasada)</i></li></ul><p>invoke_bmethod で vm_exec が終わったあとに EXEC_EVENT_HOOK(ec, RUBY_EVENT_RETURN, ...) するため、このような挙動になっているようです。<br>
これは仕様でしょうか。とりあえずささださんに振ります。</p> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=736692018-08-23T07:10:50Zko1 (Koichi Sasada)
<ul></ul><p>見逃してました。</p>
<p>これ、実装見てたら、どーしょーもない気がするんで、制限のある仕様、ってことで駄目でしょうか。駄目かなあ。実装アイディア募集。</p> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=736702018-08-23T07:11:13Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Feedback</i></li></ul> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=755272018-12-10T06:48:43Zko1 (Koichi Sasada)
<ul></ul><p>2.6では known issue にします。<br>
2.7 で、define_method したら ISeq 作るようにするとどうかな、と思っているので、それで一気に解決します。</p> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=755282018-12-10T06:49:03Zko1 (Koichi Sasada)
<ul><li><strong>Target version</strong> changed from <i>2.6</i> to <i>2.7</i></li></ul> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=762992019-01-14T07:33:20Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.7</i></del>)</li></ul> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=794192019-07-15T02:51:13Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Assigned</i></li></ul><blockquote>
<p>2.7 で、define_method したら ISeq 作るようにするとどうかな、と思っているので、それで一気に解決します。</p>
</blockquote>
<p>これでうまくいかない、ということがわかったので、ちょっと宙ぶらりんです。</p>
<p>考えていた解決案:</p>
<ul>
<li>(1) proc を受け取る</li>
<li>(2) proc のパラメータとまったく同じ method iseq を作る</li>
<li>(3) 受け取ったパラメータを proc に渡す</li>
</ul>
<p>こんな感じです。</p>
<pre><code>foo_body = proc{|a, b| xxx}
def foo(a, b) # foo_body.parameters を見て、パラメータリストを作る
foo_body[a, b]
end
</code></pre>
<p>これでいけるじゃん、天才だなと思ってたんですが、optional 引数 o = expr が入ると、うまくいかないことがわかりました。optional 引数の分を、rest で受け取っちゃう、ってのも手だけど、それだと実際に rest が居たときに面倒そうかなぁ。ああ、foo の method parameter が rest になっちゃうから良くないですね。</p>
<p>この問題について、解決案が全然思い浮かびません。</p> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=925982021-06-18T21:14:05Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/13392">Bug #13392</a>: TracePoint return event location is incorrect for methods defined with define_method</i> added</li></ul> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=925992021-06-18T21:14:28Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>The cause of this issue is the same as <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TracePoint return event location is incorrect for methods defined with define_method (Closed)" href="https://redmine.ruby-lang.org/issues/13392">#13392</a>. I've verified the pull request I submitted for that issue (<a href="https://github.com/ruby/ruby/pull/4588" class="external">https://github.com/ruby/ruby/pull/4588</a>) will also fix this issue.</p> Ruby master - Bug #14817: TracePoint#parameters for bmethod's return event should return the same value as its Method#parametershttps://redmine.ruby-lang.org/issues/14817?journal_id=953462021-12-14T17:15:31Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>fixed <a href="https://github.com/ruby/ruby/pull/4637" class="external">https://github.com/ruby/ruby/pull/4637</a></p>