Actions
Bug #21757
openSplatted args array is mutated when passing unexpected kwargs
Bug #21757:
Splatted args array is mutated when passing unexpected kwargs
Description
The bug is very simple to provoke.
proc = ->(*) { } # we do NOT expect any keyword arguments.
args = [1, 2]
proc.(*args, bug: true)
pp args #=> [1, 2, {bug: true}]
The args array now has a third element which is exactly what got passed as keyword arguments. This is only in Ruby 3.4, 3.3 and below discard the "unexpected" keyword arguments as expected.
Updated by jeremyevans0 (Jeremy Evans) about 3 hours ago
- Assignee set to jeremyevans0 (Jeremy Evans)
- Backport changed from 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
Thank you for the report. This is a bug in the allocationless anonymous splat optimization in Ruby 3.4, still present in the master branch. I'll work on a fix.
Actions