Project

General

Profile

Actions

Bug #19166

closed

Module#remove_method can change frozen modules when there is a prepended module

Added by alanwu (Alan Wu) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.7, 3.0, 3.1, dev
[ruby-core:111131]

Description

module A
  prepend Module.new # remove this line and you'd get FrozenError as expected
  def foo; end
  freeze
  remove_method :foo # remove works even though module is frozen!
  p instance_methods(false) # => []
end

Old bug, reproduces in 2.7 through 3.1 and on master. Found while investigating #19164.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19164: [3.2.0dev] Freezing an object can prevent removing methods on its classClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0