[ruby-core:66616] [ruby-trunk - Bug #10449] [TracePoint API] Duplicated line events when using parenthesis

From: deivid.rodriguez@...
Date: 2014-12-01 13:35:22 UTC
List: ruby-core #66616
Issue #10449 has been updated by David Rodr鱈guez.


Oops, I need to start thinking before talking... :) The change in the behaviour actually happened in [this example]: https://github.com/deivid-rodriguez/byebug/blob/master/test/commands/stepping_test.rb#L61-76 so something like the following used to generate 2 line events before the change.

    TracePoint.new(:line){|tp|
      p [tp.event, tp.lineno]
    }.enable{
      num = 1 ; num += 1
    }

Using semicolon is the only case I found when this happened (other that this issue), and it's not a very popular style anyways.

So definitely up for keeping this fix. Could we get this backported to 2.0 and 2.1?

THANKS!

----------------------------------------
Bug #10449: [TracePoint API] Duplicated line events when using parenthesis
https://bugs.ruby-lang.org/issues/10449#change-50233

* Author: David Rodr鱈guez
* Status: Closed
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.4p265 (2014-10-27 revision 48166) [i686-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
Sometimes, when using parenthesis, I get duplicated lines events from the TracePoint API. See the failing test case, it generates 2 line events where I think it should generate just one. 

    def test_no_duplicate_line_events
      events = []
      TracePoint.new(:line) { |tp| events << tp.event }.enable { a = (1) * 5 }

      assert_equal [:line], events
    end

Thanks!!



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

In This Thread

Prev Next