<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/spec/ruby/language/keyword_arguments_spec.rb, branch v4.0.3</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Update to ruby/spec@d8bacef</title>
<updated>2025-05-09T21:22:15+00:00</updated>
<author>
<name>Andrew Konchin</name>
<email>andry.konchin@gmail.com</email>
</author>
<published>2025-05-07T10:08:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=269ad29de95e41cc8a4eede84b98a81a6ff4f7b6'/>
<id>269ad29de95e41cc8a4eede84b98a81a6ff4f7b6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@5e579e2</title>
<updated>2025-03-27T10:09:24+00:00</updated>
<author>
<name>Andrew Konchin</name>
<email>andry.konchin@gmail.com</email>
</author>
<published>2025-03-26T17:56:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bac22c985ecc7e4309b5b5e5ae1074c81319e889'/>
<id>bac22c985ecc7e4309b5b5e5ae1074c81319e889</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@6b04c1d</title>
<updated>2024-05-19T03:08:05+00:00</updated>
<author>
<name>Andrew Konchin</name>
<email>andry.konchin@gmail.com</email>
</author>
<published>2024-05-09T17:35:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ad636033e2fdafb417873a3cb8667351033307b1'/>
<id>ad636033e2fdafb417873a3cb8667351033307b1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix keyword splat passing as regular argument</title>
<updated>2023-12-07T16:35:55+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-12-07T16:35:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ca204a20231f1ecabf5a7343aec49c3ea1bac90a'/>
<id>ca204a20231f1ecabf5a7343aec49c3ea1bac90a</id>
<content type='text'>
Since Ruby 3.0, Ruby has passed a keyword splat as a regular
argument in the case of a call to a Ruby method where the
method does not accept keyword arguments, if the method
call does not contain an argument splat:

```ruby
def self.f(obj) obj end
def self.fs(*obj) obj[0] end
h = {a: 1}
f(**h).equal?(h)  # Before: true; After: false
fs(**h).equal?(h) # Before: true; After: false

a = []
f(*a, **h).equal?(h)  # Before and After: false
fs(*a, **h).equal?(h) # Before and After: false
```

The fact that the behavior differs when passing an empty
argument splat makes it obvious that something is not
working the way it is intended.  Ruby 2 always copied
the keyword splat hash, and that is the expected behavior
in Ruby 3.

This bug is because of a missed check in setup_parameters_complex.
If the keyword splat passed is not mutable, then it points to
an existing object and not a new object, and therefore it must
be copied.

Now, there are 3 specs for the broken behavior of directly
using the keyword splatted hash.  Fix two specs and add a
new version guard. Do not keep the specs for the broken
behavior for earlier Ruby versions, in case this fix is
backported. For the ruby2_keywords spec, just remove the
related line, since that line is unrelated to what the
spec is testing.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since Ruby 3.0, Ruby has passed a keyword splat as a regular
argument in the case of a call to a Ruby method where the
method does not accept keyword arguments, if the method
call does not contain an argument splat:

```ruby
def self.f(obj) obj end
def self.fs(*obj) obj[0] end
h = {a: 1}
f(**h).equal?(h)  # Before: true; After: false
fs(**h).equal?(h) # Before: true; After: false

a = []
f(*a, **h).equal?(h)  # Before and After: false
fs(*a, **h).equal?(h) # Before and After: false
```

The fact that the behavior differs when passing an empty
argument splat makes it obvious that something is not
working the way it is intended.  Ruby 2 always copied
the keyword splat hash, and that is the expected behavior
in Ruby 3.

This bug is because of a missed check in setup_parameters_complex.
If the keyword splat passed is not mutable, then it points to
an existing object and not a new object, and therefore it must
be copied.

Now, there are 3 specs for the broken behavior of directly
using the keyword splatted hash.  Fix two specs and add a
new version guard. Do not keep the specs for the broken
behavior for earlier Ruby versions, in case this fix is
backported. For the ruby2_keywords spec, just remove the
related line, since that line is unrelated to what the
spec is testing.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@30e1c35</title>
<updated>2023-06-26T13:55:11+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2023-06-26T13:55:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=515bd4214497b3af02f6eef51b496ad9a0cf6b3b'/>
<id>515bd4214497b3af02f6eef51b496ad9a0cf6b3b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@740ccc8</title>
<updated>2022-11-07T19:05:30+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-11-07T19:05:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=83decbb62b8b3f1638927033f12b55f9b11f78c6'/>
<id>83decbb62b8b3f1638927033f12b55f9b11f78c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@d01709f</title>
<updated>2022-08-29T13:36:29+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-08-29T13:36:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4ee1a687768338a1928014fc6042c320a1a1af3e'/>
<id>4ee1a687768338a1928014fc6042c320a1a1af3e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@3affe1e</title>
<updated>2022-04-25T12:53:54+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-04-25T12:53:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=45cf4f218728a15eb36d14a6c9912086525f5e3f'/>
<id>45cf4f218728a15eb36d14a6c9912086525f5e3f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Update to ruby/spec@aaf998f</title>
<updated>2022-03-28T15:47:04+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-03-28T15:47:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8db4f25bf4327f169902afd9ea8f4b03b65656f0'/>
<id>8db4f25bf4327f169902afd9ea8f4b03b65656f0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
