From: "jeremyevans0 (Jeremy Evans) via ruby-core" Date: 2026-11-13T06:48:47+00:00 Subject: [ruby-core:127458] [Ruby Bug#22505] UnboundMethod#{bind,bind_call} results in incorrect behavior when method owner is at multiple places in ancestry Issue #22505 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed Fixed by commit:5b62da01099e458a346b2771b5d726a8a8ea8c0d ---------------------------------------- Bug #22505: UnboundMethod#{bind,bind_call} results in incorrect behavior when method owner is at multiple places in ancestry https://bugs.ruby-lang.org/issues/22505#change-119919 * Author: jeremyevans0 (Jeremy Evans) * Status: Closed * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- If a method owner is at multiple places in the ancestry, `UnboundMethod#bind` can result in incorrect behavior, making an `UnboundMethod` from a superclass method bind to a method defined in a subclass: ```ruby module M def m = [:m, *super] end class C prepend M def m = [:c] end class SC < C prepend M def m = [:sc, *super] end C.instance_method(:m).bind_call(SC.new) # => [:m, :sc, :m, :c] # Should be: [:m, :c] ``` This was originally discovered while working on #22462, but it's unrelated to method equality. The incorrect behavior appears to have started in Ruby 2.3, as Ruby 2.0-2.2 give the expected result. I've submitted a PR to fix this issue: https://github.com/ruby/ruby/pull/19695 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/