<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/vm_args.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) fc33559c: [Backport #20570]</title>
<updated>2024-07-08T23:08:42+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-07-08T23:08:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=17e21d815583ef7d6be03f29e90a219602497626'/>
<id>17e21d815583ef7d6be03f29e90a219602497626</id>
<content type='text'>
	clear `kw_flag` if given hash is nil

	https://bugs.ruby-lang.org/issues/20570 is caused I missed to
	clear the `kw_flag` even if `keyword_hash` is nil.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	clear `kw_flag` if given hash is nil

	https://bugs.ruby-lang.org/issues/20570 is caused I missed to
	clear the `kw_flag` even if `keyword_hash` is nil.
</pre>
</div>
</content>
</entry>
<entry>
<title>Prevent modification of splat array inside setup_parameters_complex</title>
<updated>2023-12-07T19:27:55+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-11-21T17:02:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=13cd963500106b366c8df9eec5c1b6815e93f07f'/>
<id>13cd963500106b366c8df9eec5c1b6815e93f07f</id>
<content type='text'>
For the following:

```
def f(*a); a end
p f(*a, kw: 3)
```

`setup_parameters_complex` pushes `{kw: 3}` onto `a`.  This worked fine
back when `concatarray true` was used and `a` was already a copy. It
does not work correctly with the optimization to switch to
`concatarray false`.  This duplicates the array on the callee side
in such a case.

This affects cases when passing a regular splat and a keyword splat
(or literal keywords) in a method call, where the method does not
accept keywords.

This allocation could probably be avoided, but doing so would
make `setup_parameters_complex` more complicated.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For the following:

```
def f(*a); a end
p f(*a, kw: 3)
```

`setup_parameters_complex` pushes `{kw: 3}` onto `a`.  This worked fine
back when `concatarray true` was used and `a` was already a copy. It
does not work correctly with the optimization to switch to
`concatarray false`.  This duplicates the array on the callee side
in such a case.

This affects cases when passing a regular splat and a keyword splat
(or literal keywords) in a method call, where the method does not
accept keywords.

This allocation could probably be avoided, but doing so would
make `setup_parameters_complex` more complicated.
</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>Ensure keyword splat method argument is hash</title>
<updated>2023-11-18T17:44:42+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-10-30T18:52:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ae48d4ad2ef7abbf116ff28b2cd3748d4c654d80'/>
<id>ae48d4ad2ef7abbf116ff28b2cd3748d4c654d80</id>
<content type='text'>
Commit e87d0882910001ef3b0c2ccd43bf00cee8c34a0c introduced a
regression where the keyword splat object passed by the caller
would be directly used by callee as keyword splat parameters,
if it implemented #to_hash.  The return value of #to_hash would be
ignored in this case.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit e87d0882910001ef3b0c2ccd43bf00cee8c34a0c introduced a
regression where the keyword splat object passed by the caller
would be directly used by callee as keyword splat parameters,
if it implemented #to_hash.  The return value of #to_hash would be
ignored in this case.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Kernel#lambda raise when given non-literal block</title>
<updated>2023-09-12T15:25:07+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2023-09-07T18:56:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=39ee3e22bd3d071c1c283b6b8dbd1af413342fb1'/>
<id>39ee3e22bd3d071c1c283b6b8dbd1af413342fb1</id>
<content type='text'>
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.

Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.

[Feature #19777]

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.

Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.

[Feature #19777]

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fetch the last element only when not empty</title>
<updated>2023-08-04T11:59:46+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-08-04T04:50:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=48f035228044e06634b46d59c8a255455cbddd70'/>
<id>48f035228044e06634b46d59c8a255455cbddd70</id>
<content type='text'>
Also `flag_keyword_hash` sets to 0 or a hash object.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also `flag_keyword_hash` sets to 0 or a hash object.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove RARRAY_CONST_PTR_TRANSIENT</title>
<updated>2023-07-13T18:48:14+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-07-13T13:45:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=32231812845e5302bd457f7e4a534e7965d89d49'/>
<id>32231812845e5302bd457f7e4a534e7965d89d49</id>
<content type='text'>
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix autosplat conditions to handle ruby2_keywords case</title>
<updated>2023-07-10T17:06:23+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-07-10T17:06:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3874381c4483ba7794ac2abf157e265546f9bfa7'/>
<id>3874381c4483ba7794ac2abf157e265546f9bfa7</id>
<content type='text'>
Autosplat should not occur if there are two arguments but second
argument is an array containing a ruby2_keywords splat. Only
autosplat if a single argument to be yielded to the block, and there
is no splatted flagged keyword hash passed.

Fixes [Bug #19759]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Autosplat should not occur if there are two arguments but second
argument is an array containing a ruby2_keywords splat. Only
autosplat if a single argument to be yielded to the block, and there
is no splatted flagged keyword hash passed.

Fixes [Bug #19759]</pre>
</div>
</content>
</entry>
<entry>
<title>`Hash#dup` for kwsplat arguments</title>
<updated>2023-03-15T09:05:13+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2023-03-13T18:42:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6462c1a042fec4017f7e3bf2c13ec6a29efd23d6'/>
<id>6462c1a042fec4017f7e3bf2c13ec6a29efd23d6</id>
<content type='text'>
On `f(*a, **kw)` method calls, a rest keyword parameter is identically
same Hash object is passed and it should make `#dup`ed Hahs.

fix https://bugs.ruby-lang.org/issues/19526
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On `f(*a, **kw)` method calls, a rest keyword parameter is identically
same Hash object is passed and it should make `#dup`ed Hahs.

fix https://bugs.ruby-lang.org/issues/19526
</pre>
</div>
</content>
</entry>
<entry>
<title>Stop exporting symbols for MJIT</title>
<updated>2023-03-07T05:59:23+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2023-03-07T05:34:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=233ddfac541749a0da80ea27913dc1ef4ea700bb'/>
<id>233ddfac541749a0da80ea27913dc1ef4ea700bb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
