ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: merch-redmine@jeremyevans.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:95192] [Ruby master Bug#15629] super_method fails on binded/unbinded/cloned methods
Date: Wed, 02 Oct 2019 22:24:51 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-81866.20191002222450.671ece6da03a7fd8@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15629.20190301005719@ruby-lang.org

Issue #15629 has been updated by jeremyevans0 (Jeremy Evans).

File super_method-bind-unbind-clone-15629.patch added

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.

----------------------------------------
Bug #15629: super_method fails on binded/unbinded/cloned methods
https://bugs.ruby-lang.org/issues/15629#change-81866

* Author: wanabe (_ wanabe)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
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)


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

      parent reply	other threads:[~2019-10-02 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15629.20190301005719@ruby-lang.org>
2019-03-01  0:57 ` [ruby-core:91649] [Ruby trunk Bug#15629] super_method fails on binded/unbinded/cloned methods s.wanabe
2019-10-02 22:24 ` merch-redmine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-81866.20191002222450.671ece6da03a7fd8@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).