Project

General

Profile

Actions

Bug #15629

closed

super_method fails on binded/unbinded/cloned methods

Added by wanabe (_ wanabe) about 5 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:91649]

Description

derived from #13973:

module A
  def foo
  end
end

module B
  def foo
  end
end

class C
  include A
  include B
end

c = C.new
m1 = c.method(:foo)
p m1.super_method         # => #<Method: A#foo>
p m1.clone.super_method   # => nil
p m1.unbind.super_method  # => nil

m2 = C.instance_method(:foo)
p m2.super_method         # => #<UnboundMethod: A#foo>
p m2.clone.super_method   # => nil
p m2.bind(c).super_method # => nil

super_method of binded/unbinded/cloned method should be super_method of original method, shouldn't it?


Files

super_method-bind-unbind-clone-15629.patch (4.85 KB) super_method-bind-unbind-clone-15629.patch jeremyevans0 (Jeremy Evans), 10/02/2019 10:23 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #13973: super_method fails on some UnboundMethodsClosednobu (Nobuyoshi Nakada)Actions
Actions #1

Updated by wanabe (_ wanabe) about 5 years ago

  • Related to Bug #13973: super_method fails on some UnboundMethods added

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

This bug is due to the fact that bind/unbind/clone do not copy the iclass entry, and without an iclass entry, super_method returns nil. Attached is a patch that fixes this issue.

Actions #3

Updated by jeremyevans (Jeremy Evans) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|a91637c516779d9ecee5f323e211f0ed71eb06ad.


Make {Method,UnboundMethod}#super_method handle clone/bind/unbind

This wasn't working previously because the iclass entry wasn't
being copied, and without an iclass entry, super_method returns
nil.

Fixes [Bug #15629]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0