ActionsLike0
Bug #9813
closedModule#initialize_copy does not clean the tables
Description
Module#initialize_copy
で定数やインスタンス変数を持たないModule
をコピーしても、元の定数やインスタンス変数が残っています。
m = Module.new do
def x
end
const_set(:X, 1)
@x = 2
end
p m.instance_methods, m.instance_variables, m.constants
#=> [:x]
#=> [:@x]
#=> [:X]
m.module_eval do
initialize_copy(Module.new)
end
p m.instance_methods, m.instance_variables, m.constants
#=> []
#=> [:@x]
#=> [:X]
1.8でinitialize_copy
が導入された当初からあるバグのようです。
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Updated by nagachika (Tomoyuki Chikanaga) almost 11 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED to 2.0.0: REQUIRED, 2.1: DONE
Updated by usa (Usaku NAKAMURA) almost 11 years ago
- Backport changed from 2.0.0: REQUIRED, 2.1: DONE to 2.0.0: DONE, 2.1: DONE
ActionsLike0