From: "tenderlovemaking (Aaron Patterson) via ruby-core" Date: 2026-11-10T04:32:40+00:00 Subject: [ruby-core:127395] [Ruby Bug#22529] Array#fill should respect frozenness from yields Issue #22529 has been reported by tenderlovemaking (Aaron Patterson). ---------------------------------------- Bug #22529: Array#fill should respect frozenness from yields https://bugs.ruby-lang.org/issues/22529 * Author: tenderlovemaking (Aaron Patterson) * Status: Open * ruby -v: ruby 4.0.9 (2026-10-23 revision 3e93b23afc) +PRISM [arm64-darwin25] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Array#fill yields to a block, and the array could get frozen in the block, so we need to check for it. I expect the following program to raise an exception, but instead the array is mutated: ```ruby a = [1, 2, 3] a.fill { a.freeze; 9 } p a ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/