Issue #13107 has been updated by Eugene Kenny.

File 0001-forwardable-impl.rb-include-trace-instruction.patch added

Here's another patch that also fixes the problem, while keeping the optimisation from r55376.

I'll admit that I have no idea what this option does or how it could cause this bug - I noticed that the "portable" implementation of `forwardable/impl.rb` wasn't affected, and fiddled with the MRI-specific one until it worked. Please review this patch carefully if you intend to use it!

Removing `tailcall_optimization` also appears to work, although I think we need that option to get a sensible stack trace. Maybe `trace_instruction: false, tailcall_optimization: true` is an invalid combination?

----------------------------------------
Bug #13107: def_delegators causes random errors in MRI 2.4.0
https://bugs.ruby-lang.org/issues/13107#change-62421

* Author: Thomas Walpole
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
In the Capybara project we use the rack_test gem which uses def_delegators to forward last_reponse to @rack_mock_session - https://github.com/brynary/rack-test/blob/master/lib/rack/test.rb#L29

When running the Capybara test test suite calling last_reponse on a rack_test Session object will sporadically result in a TypeError from forwardable.rb

TypeError:
       wrong argument type Integer (expected Proc)

Patching around the delegator with

class Rack::Test::Session
  def last_response
    @rack_mock_session.last_response
  end
 end

stops the error from occurring, so it appears that something def_delegators is doing is causing problems.  Unfortunately I have not yet been able to establish exactly what causes the issues to produce a simple test case.

---Files--------------------------------
0001-forwardable.rb-use-public_send-to-call-method.patch (789 Bytes)
0001-forwardable-impl.rb-include-trace-instruction.patch (773 Bytes)


-- 
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>