* [ruby-core:123980] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs
@ 2025-12-02 16:26 apotonick (Nick Sutterer) via ruby-core
2025-12-02 17:11 ` [ruby-core:123984] " jeremyevans0 (Jeremy Evans) via ruby-core
2025-12-03 5:36 ` [ruby-core:123991] " jeremyevans0 (Jeremy Evans) via ruby-core
0 siblings, 2 replies; 3+ messages in thread
From: apotonick (Nick Sutterer) via ruby-core @ 2025-12-02 16:26 UTC (permalink / raw)
To: ruby-core; +Cc: apotonick (Nick Sutterer)
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:123984] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs
2025-12-02 16:26 [ruby-core:123980] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs apotonick (Nick Sutterer) via ruby-core
@ 2025-12-02 17:11 ` jeremyevans0 (Jeremy Evans) via ruby-core
2025-12-03 5:36 ` [ruby-core:123991] " jeremyevans0 (Jeremy Evans) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-12-02 17:11 UTC (permalink / raw)
To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)
Issue #21757 has been updated by jeremyevans0 (Jeremy Evans).
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.
----------------------------------------
Bug #21757: Splatted args array is mutated when passing unexpected kwargs
https://bugs.ruby-lang.org/issues/21757#change-115412
* Author: apotonick (Nick Sutterer)
* Status: Open
* Assignee: jeremyevans0 (Jeremy Evans)
* ruby -v: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
* Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
----------------------------------------
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:123991] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs
2025-12-02 16:26 [ruby-core:123980] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs apotonick (Nick Sutterer) via ruby-core
2025-12-02 17:11 ` [ruby-core:123984] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2025-12-03 5:36 ` jeremyevans0 (Jeremy Evans) via ruby-core
1 sibling, 0 replies; 3+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-12-03 5:36 UTC (permalink / raw)
To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)
Issue #21757 has been updated by jeremyevans0 (Jeremy Evans).
I submitted a pull request to fix this: https://github.com/ruby/ruby/pull/15383
----------------------------------------
Bug #21757: Splatted args array is mutated when passing unexpected kwargs
https://bugs.ruby-lang.org/issues/21757#change-115418
* Author: apotonick (Nick Sutterer)
* Status: Open
* Assignee: jeremyevans0 (Jeremy Evans)
* ruby -v: ruby 3.4.7 (2025-10-08 revision 7a5688e2a2) +PRISM [x86_64-linux]
* Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED
----------------------------------------
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-03 5:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 16:26 [ruby-core:123980] [Ruby Bug#21757] Splatted args array is mutated when passing unexpected kwargs apotonick (Nick Sutterer) via ruby-core
2025-12-02 17:11 ` [ruby-core:123984] " jeremyevans0 (Jeremy Evans) via ruby-core
2025-12-03 5:36 ` [ruby-core:123991] " jeremyevans0 (Jeremy Evans) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).