From: zn@... Date: 2018-01-06T05:29:36+00:00 Subject: [ruby-core:84671] [Ruby trunk Bug#14266] Set#clone(freeze: false) makes frozen internal hash Issue #14266 has been updated by znz (Kazuhiro NISHIYAMA). Assignee set to knu (Akinori MUSHA) (ref [Fix Set#clone to clone internal hash.](https://github.com/ruby/ruby/pull/661)) ---------------------------------------- Bug #14266: Set#clone(freeze: false) makes frozen internal hash https://bugs.ruby-lang.org/issues/14266#change-69388 * Author: znz (Kazuhiro NISHIYAMA) * Status: Open * Priority: Normal * Assignee: knu (Akinori MUSHA) * Target version: * ruby -v: ruby 2.6.0dev (2018-01-01 trunk 61537) [x86_64-darwin16] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ``` % irb -r irb/completion --simple-prompt >> require 'set' => true >> set=Set[].freeze.clone(freeze: false) => # >> 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 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: