From: ruby-core@...
Date: 2017-10-26T06:54:54+00:00
Subject: [ruby-core:83572] [Ruby trunk Bug#14057] TracePoint#enable and disable should not yield arguments

Issue #14057 has been reported by marcandre (Marc-Andre Lafortune).

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

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: marcandre (Marc-Andre Lafortune)
* Target version: 2.5
* ruby -v: trunk
* Backport: 2.3: REQUIRED, 2.4: REQUIRED
----------------------------------------
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>