<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby.git/test/ruby/test_hash.rb, branch ruby_3_2</title>
<subtitle>github.com: ruby/ruby.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/'/>
<entry>
<title>Fix inconsistency with opt_aref_with</title>
<updated>2022-08-04T21:48:47+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2022-07-28T23:41:46+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=70b60d24b9c3859a859853ddb2e17c603bd3485b'/>
<id>70b60d24b9c3859a859853ddb2e17c603bd3485b</id>
<content type='text'>
opt_aref_with is an optimized instruction for accessing a Hash using a
non-frozen string key (ie. from a file without frozen_string_literal).
It attempts to avoid allocating the string, and instead silently using a
frozen string (hash string keys are always fstrings).

Because this is just an optimization, it should be invisible to the
user. However, previously this optimization was could be seen via hashes
with default procs.

For example, previously:

    h = Hash.new { |h, k| k.frozen? }
    str = "foo"
    h[str]   # false
    h["foo"] # true when optimizations enabled

This commit checks that the Hash doesn't have a default proc when using
opt_aref_with.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
opt_aref_with is an optimized instruction for accessing a Hash using a
non-frozen string key (ie. from a file without frozen_string_literal).
It attempts to avoid allocating the string, and instead silently using a
frozen string (hash string keys are always fstrings).

Because this is just an optimization, it should be invisible to the
user. However, previously this optimization was could be seen via hashes
with default procs.

For example, previously:

    h = Hash.new { |h, k| k.frozen? }
    str = "foo"
    h[str]   # false
    h["foo"] # true when optimizations enabled

This commit checks that the Hash doesn't have a default proc when using
opt_aref_with.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make method id explicit in rb_exec_recursive_outer</title>
<updated>2022-06-10T21:48:21+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2022-06-10T16:43:05+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=52da90aceefd9f8de06666796f6a2d484ca18036'/>
<id>52da90aceefd9f8de06666796f6a2d484ca18036</id>
<content type='text'>
Previously, because opt_aref and opt_aset don't push a frame, when they
would call rb_hash to determine the hash value of the key, the initial
level of recursion would incorrectly use the method id at the top of the
stack instead of "hash".

This commit replaces rb_exec_recursive_outer with
rb_exec_recursive_outer_mid, which takes an explicit method id, so that
we can make the hash calculation behave consistently.

rb_exec_recursive_outer was documented as being internal, so I believe
this should be okay to change.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, because opt_aref and opt_aset don't push a frame, when they
would call rb_hash to determine the hash value of the key, the initial
level of recursion would incorrectly use the method id at the top of the
stack instead of "hash".

This commit replaces rb_exec_recursive_outer with
rb_exec_recursive_outer_mid, which takes an explicit method id, so that
we can make the hash calculation behave consistently.

rb_exec_recursive_outer was documented as being internal, so I believe
this should be okay to change.
</pre>
</div>
</content>
</entry>
<entry>
<title>st.c: Do not clear entries_bound when calling Hash#shift for empty hash</title>
<updated>2022-02-09T15:14:27+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-02-09T09:24:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=496591de96b261b8789332c7f8b2bfbd17658955'/>
<id>496591de96b261b8789332c7f8b2bfbd17658955</id>
<content type='text'>
tab-&gt;entries_bound is used to check if the bins are full in
rebuild_table_if_necessary.

Hash#shift against an empty hash assigned 0 to tab-&gt;entries_bound, but
didn't clear the bins. Thus, the table is not rebuilt even when the bins
are full. Attempting to add a new element into full-bin hash gets stuck.

This change stops clearing tab-&gt;entries_bound in Hash#shift.
[Bug #18578]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
tab-&gt;entries_bound is used to check if the bins are full in
rebuild_table_if_necessary.

Hash#shift against an empty hash assigned 0 to tab-&gt;entries_bound, but
didn't clear the bins. Thus, the table is not rebuilt even when the bins
are full. Attempting to add a new element into full-bin hash gets stuck.

This change stops clearing tab-&gt;entries_bound in Hash#shift.
[Bug #18578]
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Hash#shift return nil for empty hash</title>
<updated>2022-01-14T20:17:57+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2021-12-27T22:41:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=a93cc3e23b4044762e80820fc7a45606587e11db'/>
<id>a93cc3e23b4044762e80820fc7a45606587e11db</id>
<content type='text'>
Fixes [Bug #16908]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [Bug #16908]
</pre>
</div>
</content>
</entry>
<entry>
<title>Add documentation and tests for keyword argument value omission</title>
<updated>2021-09-11T11:23:36+00:00</updated>
<author>
<name>Shugo Maeda</name>
<email>shugo@ruby-lang.org</email>
</author>
<published>2021-09-11T11:23:36+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=297f9b8d4c4502aa2ba0eccf93dfce215a7b6dfe'/>
<id>297f9b8d4c4502aa2ba0eccf93dfce215a7b6dfe</id>
<content type='text'>
[Feature #14579]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Feature #14579]
</pre>
</div>
</content>
</entry>
<entry>
<title>Another test for [Feature #14579]</title>
<updated>2021-09-11T10:09:37+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-09-11T10:07:02+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=7899866849c1bac708e513e5d9e14467a0155a9e'/>
<id>7899866849c1bac708e513e5d9e14467a0155a9e</id>
<content type='text'>
The value of the dynamic key cannot be omitted for now.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The value of the dynamic key cannot be omitted for now.
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow value omission in Hash literals</title>
<updated>2021-09-11T09:52:25+00:00</updated>
<author>
<name>Shugo Maeda</name>
<email>shugo@ruby-lang.org</email>
</author>
<published>2021-09-11T09:49:12+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=c60dbcd1c55cd77a24c41d5e1a9555622be8b2b8'/>
<id>c60dbcd1c55cd77a24c41d5e1a9555622be8b2b8</id>
<content type='text'>
`{x:, y:}` is a syntax sugar of `{x: x, y: y}`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`{x:, y:}` is a syntax sugar of `{x: x, y: y}`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Free previously used tables [Bug #18134]</title>
<updated>2021-08-29T08:18:58+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-08-29T07:47:26+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=a615885f1e87f4bfbc5398b060fd3a64d5de8c4a'/>
<id>a615885f1e87f4bfbc5398b060fd3a64d5de8c4a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove old warning aged nearly 8 years</title>
<updated>2021-08-19T08:44:48+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-08-19T08:37:06+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=6963f8f743b42f9004a0879cd66c550f18987352'/>
<id>6963f8f743b42f9004a0879cd66c550f18987352</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Copy hash compare_by_identity setting in more cases</title>
<updated>2021-07-15T17:04:17+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2021-07-15T17:04:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/ruby.git/commit/?id=95f8ffa5f6c70aa9383e1f6db02b22707c183402'/>
<id>95f8ffa5f6c70aa9383e1f6db02b22707c183402</id>
<content type='text'>
This makes the compare_by_identity setting always copied
for the following methods:

* except
* merge
* reject
* select
* slice
* transform_values

Some of these methods did not copy the setting, or only
copied the setting if the receiver was not empty.

Fixes [Bug #17757]

Co-authored-by: Kenichi Kamiya &lt;kachick1@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes the compare_by_identity setting always copied
for the following methods:

* except
* merge
* reject
* select
* slice
* transform_values

Some of these methods did not copy the setting, or only
copied the setting if the receiver was not empty.

Fixes [Bug #17757]

Co-authored-by: Kenichi Kamiya &lt;kachick1@gmail.com&gt;</pre>
</div>
</content>
</entry>
</feed>
