Actions
Bug #14266
closedSet#clone(freeze: false) makes frozen internal hash
Description
% irb -r irb/completion --simple-prompt
>> require 'set'
=> true
>> set=Set[].freeze.clone(freeze: false)
=> #<Set: {}>
>> set.frozen?
=> false
>> set.instance_variable_get(:@hash).frozen?
=> true
In Set#initialize_clone
, clone hash without freeze keyword argument.
But I think there is no easy way how to know freeze keyword argument value in initialize_clone
.
# Clone internal hash.
def initialize_clone(orig)
super
@hash = orig.instance_variable_get(:@hash).clone
end
Actions
Like0
Like0Like0Like0Like0