Project

General

Profile

Actions

Bug #18292

closed

3.1.0-dev `include` cause Module to be marked as initialized

Added by byroot (Jean Boussier) over 2 years ago. Updated about 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0dev (2021-11-08T09:35:22Z master 7cc4e147fc)
[ruby-core:105966]

Description

Some subtle change I found while testing our app compatibility with Ruby head:

class Mod1 < Module
  def initialize(...)
    super
  end
end
p Mod1.new

class Mod2 < Module
  def initialize(...)
    include Enumerable
    super
  end
end
p Mod2.new

On 3.0:

#<Mod1:0x00007fbf9b825b38>
#<Mod2:0x00007fbf9b825818>

On ruby-head:

#<Mod1:0x00000001108cb1d8>
/tmp/module.rb:11:in `initialize': already initialized module (TypeError)
	from /tmp/module.rb:11:in `initialize'

I suspect this might be a result of https://bugs.ruby-lang.org/issues/17048, but I have to admit I'm not certain so I'd rather report it.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0