From: SASADA Koichi Date: 2013-06-14T18:56:04+09:00 Subject: [ruby-core:55486] Re: [ruby-trunk - Bug #8489] Tracepoint API: B_RETURN_EVENT not triggered when "next" used Thank youf for your report. I fixed it. Could you check it? (2013/06/14 17:55), deivid (David Rodr��guez) wrote: > > Issue #8489 has been updated by deivid (David Rodr��guez). > > > This is the "no replies after 10 days reminder". > > If this is not a priority right now, I can try have a look at this myself (not sure how it will go though...). > > Thanks again. > ---------------------------------------- > Bug #8489: Tracepoint API: B_RETURN_EVENT not triggered when "next" used > https://bugs.ruby-lang.org/issues/8489#change-39925 > > Author: deivid (David Rodr��guez) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > ruby -v: ruby 2.0.0p201 (2013-06-04) [i686-linux] > Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN > > > I'm using the Tracepoint API in my gem and I notice that when the keyword next is used inside a block, a block return event (B_RETURN_EVENT) is not triggered. For example, I would expect the same number of B_CALL_EVENT and B_RETURN_EVENT in the piece of code: > > traceBlocks = TracePoint.new(:b_call, :b_return) do |tp| > p "#{tp.event == :b_call ? 'Block called' : 'Block returned'}" > end.enable do > 3.times do > next > end > end > > but instead there are 4 B_CALL_EVENT and 1 B_RETURN_EVENT. As I understand it, "next" causes the block to exit immediately, returning control to the iterator, which may invoke the block again, so I would say a block return event should be triggered. > > Thanks a lot. > > -- // SASADA Koichi at atdot dot net