From: "apotonick (Nick Sutterer) via ruby-core" Date: 2025-12-02T16:26:10+00:00 Subject: [ruby-core:123980] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs Issue #21757 has been reported by apotonick (Nick Sutterer). ---------------------------------------- Bug #21757: Splatted args array is mutated when passing unexpected kwargs https://bugs.ruby-lang.org/issues/21757 * Author: apotonick (Nick Sutterer) * Status: Open * ruby -v: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The bug is very simple to provoke. ``` ruby 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. -- 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/