From: nagachika00@... Date: 2021-05-23T07:10:06+00:00 Subject: [ruby-core:103998] [Ruby master Bug#17736] Destructive methods inconsistently handle `receiver frozen state` in given block Issue #17736 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE ruby_3_0 44b87adc07621b6a8eddfcf4aaff34ce634179d4 merged revision(s) e019dd24df4ed7063ad80d4c2e4070141793f598,7954bb056be30e86c419fe3792064d28990a4999,7d3fdfb27dac456827b004d9e66a44b15f8cd762. ---------------------------------------- Bug #17736: Destructive methods inconsistently handle `receiver frozen state` in given block https://bugs.ruby-lang.org/issues/17736#change-92135 * Author: kachick (Kenichi Kamiya) * Status: Closed * Priority: Normal * ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20] * Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED, 3.0: DONE ---------------------------------------- When I interested around https://bugs.ruby-lang.org/issues/17735, I found following behaviors. ```ruby array = [1, 2, 3, 42] array.select! do array.freeze false end p array #=> [] ``` ```ruby array = [1, 2, 3, 42, 2, 3] begin array.uniq! do |item| array.freeze item end rescue => err p err #=> # end p array #=> [1, 2, 3, 42, 2, 3] ``` ```ruby hash = {a: 1, b: 2, c: 3} hash.select! do hash.freeze false end p hash #=> {} ``` Is this an intentional behavior? I would expect `To raise FrozenError` and `Does not modify receiver after frozen` like Array#uniq!. -- https://bugs.ruby-lang.org/ Unsubscribe: