[ruby-core:86187] [Ruby trunk Bug#14057] TracePoint#enable and disable should not yield arguments

From: usa@...
Date: 2018-03-18 15:23:38 UTC
List: ruby-core #86187
Issue #14057 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE

ruby_2_3 r62824 merged revision(s) 60437.

----------------------------------------
Bug #14057: TracePoint#enable and disable should not yield arguments
https://bugs.ruby-lang.org/issues/14057#change-71074

* Author: marcandre (Marc-Andre Lafortune)
* Status: Closed
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
* Target version: 2.5
* ruby -v: trunk
* Backport: 2.3: DONE, 2.4: DONE
----------------------------------------
While working on RubySpecs with Atul Bhosale, we discovered that `TracePoint#enable` and `#disable` yield `nil` instead of not yielding any argument.

This is mostly harmless as we usually use blocks, but it could create issues for lambdas/methods, for example:

~~~ ruby
def handle_trace; end

TracePoint.new{}.enable(&method(:handle_trace)) # => ArgumentError: wrong number of arguments (given 1, expected 0)

~~~

I'm fixing in trunk, would be nice to backport.





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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next