From: naruse@... Date: 2020-03-14T11:24:48+00:00 Subject: [ruby-core:97495] [Ruby master Bug#16642] Splatted empty hash literal produces frozen hash object Issue #16642 has been updated by naruse (Yui NARUSE). Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ruby_2_7 7804720c631d309b2f19457e703ecfb47a59589f. ---------------------------------------- Bug #16642: Splatted empty hash literal produces frozen hash object https://bugs.ruby-lang.org/issues/16642#change-84643 * Author: Dan0042 (Daniel DeLorme) * Status: Closed * Priority: Normal * ruby -v: ruby 2.7.1p37 (2020-02-20) [x86_64-openbsd6.6] * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ---------------------------------------- When splatting an empty hash literal, internally it's optimized using a global frozen hash object, but this implementation detail can leak into the ruby code outside: ```ruby ruby2_keywords def foo(*a) a.last end h = foo(**{}) h[1] = 2 # can't modify frozen Hash: {} (FrozenError) ``` I think this can be considered a bug? ---Files-------------------------------- ruby2_keywords-empty-kw-splat-16642.patch (2.49 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: