Project

General

Profile

Actions

Bug #16942

closed

instance_method causes an infinite loop with prepend, include and private

Added by pocke (Masataka Kuwabara) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.8.0dev (2020-06-09T13:51:54Z master 7f3efee102) [x86_64-linux]
[ruby-core:98691]

Description

instance_method causes an infinite loop with the following code.

module M
  def x
  end
end

module M2
  include M
  private :x
end

::Object.prepend(M2)

# infinite loop
p Object.instance_method(:x)

I've confirmed it on the master branch. The commit is 7f3efee102.
But instance_method works correctly with Ruby 2.7.1.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0