<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_class.rb, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>make rb_singleton_class ractor safe (#15591)</title>
<updated>2025-12-18T17:37:27+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-12-18T17:37:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bfd28d581c524c7a7df877f2425de9fdd8de161a'/>
<id>bfd28d581c524c7a7df877f2425de9fdd8de161a</id>
<content type='text'>
Since singleton classes are created lazily, we need to make sure that
we lock around their creation.  Unfortunately, that means we need to
lock around every shareable object's call to `singleton_class`,
including classes and modules.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since singleton classes are created lazily, we need to make sure that
we lock around their creation.  Unfortunately, that means we need to
lock around every shareable object's call to `singleton_class`,
including classes and modules.</pre>
</div>
</content>
</entry>
<entry>
<title>Use rb_error_frozen_object in rb_class_modify_check</title>
<updated>2025-12-09T22:35:50+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2025-11-23T03:58:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e436dba9fee4c75104212ad0fd16ab7f753985c4'/>
<id>e436dba9fee4c75104212ad0fd16ab7f753985c4</id>
<content type='text'>
This provides information on the class of the frozen object. It also
results in a much simpler implementation.

Fixes [Bug #21374]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This provides information on the class of the frozen object. It also
results in a much simpler implementation.

Fixes [Bug #21374]
</pre>
</div>
</content>
</entry>
<entry>
<title>Take VM lock in `class_switch_superclass` (#15356)</title>
<updated>2025-12-04T21:10:21+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-12-04T21:10:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=de2c2bd60fdce52cc7ba38a25f3e9436442af604'/>
<id>de2c2bd60fdce52cc7ba38a25f3e9436442af604</id>
<content type='text'>
Safe multi-ractor subclass list mutation

We need to lock around mutation and accesses of a class's subclasses
list. Unfortunately we also need to do this when creating singleton
classes, as the singleton class does need to go into `super`'s
subclasses list for CC invalidation purposes.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Safe multi-ractor subclass list mutation

We need to lock around mutation and accesses of a class's subclasses
list. Unfortunately we also need to do this when creating singleton
classes, as the singleton class does need to go into `super`'s
subclasses list for CC invalidation purposes.</pre>
</div>
</content>
</entry>
<entry>
<title>Test CC invalidation for singleton classes of objects (#15360)</title>
<updated>2025-12-01T21:51:29+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-12-01T21:51:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a8b49ab48703dfb8862ca28a443da0e764d692c6'/>
<id>a8b49ab48703dfb8862ca28a443da0e764d692c6</id>
<content type='text'>
I made a recent change where all the tests passed but it turns out it
was still wrong. We didn't have any tests for CC invalidation on
singletons of objects that aren't classes or modules.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I made a recent change where all the tests passed but it turns out it
was still wrong. We didn't have any tests for CC invalidation on
singletons of objects that aren't classes or modules.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "ns_subclasses refcount accesses need to be atomic (#15083)" (#15138)</title>
<updated>2025-11-11T02:52:43+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-11-11T02:52:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=148fde27545ee35c8aab4ec7bca027184d79fbc4'/>
<id>148fde27545ee35c8aab4ec7bca027184d79fbc4</id>
<content type='text'>
This reverts commit 2998c8d6b99ec49925ebea42198b29c3e27b34a7.

We need to find a better way to fix this bug. Even with this refcount
change, errors were still being seen in CI. For now we need to remove
this failing test.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 2998c8d6b99ec49925ebea42198b29c3e27b34a7.

We need to find a better way to fix this bug. Even with this refcount
change, errors were still being seen in CI. For now we need to remove
this failing test.</pre>
</div>
</content>
</entry>
<entry>
<title>ns_subclasses refcount accesses need to be atomic (#15083)</title>
<updated>2025-11-06T21:32:20+00:00</updated>
<author>
<name>Luke Gruber</name>
<email>luke.gruber@shopify.com</email>
</author>
<published>2025-11-06T21:32:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2998c8d6b99ec49925ebea42198b29c3e27b34a7'/>
<id>2998c8d6b99ec49925ebea42198b29c3e27b34a7</id>
<content type='text'>
We were seeing errors like:

```
* thread #8, stop reason = EXC_BAD_ACCESS (code=1, address=0x803)
  * frame #0: 0x00000001001fe944 ruby`rb_st_lookup(tab=0x00000000000007fb, key=1, value=0x00000001305b7490) at st.c:1066:22
    frame #1: 0x000000010002d658 ruby`remove_class_from_subclasses [inlined] class_get_subclasses_for_ns(tbl=0x00000000000007fb, ns_id=1) at class.c:604:9
    frame #2: 0x000000010002d650 ruby`remove_class_from_subclasses(tbl=0x00000000000007fb, ns_id=1, klass=4754039232) at class.c:620:34
    frame #3: 0x000000010002c8a8 ruby`rb_class_classext_free_subclasses(ext=0x000000011b5ce1d8, klass=4754039232, replacing=&lt;unavailable&gt;) at class.c:700:9
    frame #4: 0x000000010002c760 ruby`rb_class_classext_free(klass=4754039232, ext=0x000000011b5ce1d8, is_prime=true) at class.c:105:5
    frame #5: 0x00000001000e770c ruby`classext_free(ext=&lt;unavailable&gt;, is_prime=&lt;unavailable&gt;, namespace=&lt;unavailable&gt;, arg=&lt;unavailable&gt;) at gc.c:1231:5 [artificial]
    frame #6: 0x000000010002d178 ruby`rb_class_classext_foreach(klass=&lt;unavailable&gt;, func=(ruby`classext_free at gc.c:1228), arg=0x00000001305b75c0) at class.c:518:5
    frame #7: 0x00000001000e745c ruby`rb_gc_obj_free(objspace=0x000000012500c400, obj=4754039232) at gc.c:1282:9
    frame #8: 0x00000001000e70d4 ruby`gc_sweep_plane(objspace=0x000000012500c400, heap=&lt;unavailable&gt;, p=4754039232, bitset=4095, ctx=0x00000001305b76e8) at default.c:3482:21
    frame #9: 0x00000001000e6e9c ruby`gc_sweep_page(objspace=0x000000012500c400, heap=0x000000012500c540, ctx=0x00000001305b76e8) at default.c:3567:13
    frame #10: 0x00000001000e51d0 ruby`gc_sweep_step(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:3848:9
    frame #11: 0x00000001000e1880 ruby`gc_continue [inlined] gc_sweep_continue(objspace=0x000000012500c400, sweep_heap=0x000000012500c540) at default.c:3931:13
    frame #12: 0x00000001000e1754 ruby`gc_continue(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2037:9
    frame #13: 0x00000001000e10bc ruby`newobj_cache_miss [inlined] heap_prepare(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2056:5
    frame #14: 0x00000001000e1074 ruby`newobj_cache_miss [inlined] heap_next_free_page(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2280:9
    frame #15: 0x00000001000e106c ruby`newobj_cache_miss(objspace=0x000000012500c400, cache=0x0000600001b00300, heap_idx=2, vm_locked=false) at default.c:2387:38
    frame #16: 0x00000001000e0d28 ruby`newobj_alloc(objspace=&lt;unavailable&gt;, cache=&lt;unavailable&gt;, heap_idx=&lt;unavailable&gt;, vm_locked=&lt;unavailable&gt;) at default.c:2411:15 [artificial]
    frame #17: 0x00000001000d7214 ruby`newobj_of [inlined] rb_gc_impl_new_obj(objspace_ptr=&lt;unavailable&gt;, cache_ptr=&lt;unavailable&gt;, klass=&lt;unavailable&gt;, flags=&lt;unavailable&gt;, wb_protected=&lt;unavailable&gt;, alloc_size=&lt;unavailable&gt;) at default.c:2490:15
    frame #18: 0x00000001000d719c ruby`newobj_of(cr=&lt;unavailable&gt;, klass=4313971728, flags=258, wb_protected=&lt;unavailable&gt;, size=&lt;unavailable&gt;) at gc.c:995:17
    frame #19: 0x00000001000d73ec ruby`rb_wb_protected_newobj_of(ec=&lt;unavailable&gt;, klass=&lt;unavailable&gt;, flags=&lt;unavailable&gt;, size=&lt;unavailable&gt;) at gc.c:1044:12 [artificial]
    frame #20: 0x0000000100032d34 ruby`class_alloc0(type=&lt;unavailable&gt;, klass=4313971728, namespaceable=&lt;unavailable&gt;) at class.c:803:5
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We were seeing errors like:

```
* thread #8, stop reason = EXC_BAD_ACCESS (code=1, address=0x803)
  * frame #0: 0x00000001001fe944 ruby`rb_st_lookup(tab=0x00000000000007fb, key=1, value=0x00000001305b7490) at st.c:1066:22
    frame #1: 0x000000010002d658 ruby`remove_class_from_subclasses [inlined] class_get_subclasses_for_ns(tbl=0x00000000000007fb, ns_id=1) at class.c:604:9
    frame #2: 0x000000010002d650 ruby`remove_class_from_subclasses(tbl=0x00000000000007fb, ns_id=1, klass=4754039232) at class.c:620:34
    frame #3: 0x000000010002c8a8 ruby`rb_class_classext_free_subclasses(ext=0x000000011b5ce1d8, klass=4754039232, replacing=&lt;unavailable&gt;) at class.c:700:9
    frame #4: 0x000000010002c760 ruby`rb_class_classext_free(klass=4754039232, ext=0x000000011b5ce1d8, is_prime=true) at class.c:105:5
    frame #5: 0x00000001000e770c ruby`classext_free(ext=&lt;unavailable&gt;, is_prime=&lt;unavailable&gt;, namespace=&lt;unavailable&gt;, arg=&lt;unavailable&gt;) at gc.c:1231:5 [artificial]
    frame #6: 0x000000010002d178 ruby`rb_class_classext_foreach(klass=&lt;unavailable&gt;, func=(ruby`classext_free at gc.c:1228), arg=0x00000001305b75c0) at class.c:518:5
    frame #7: 0x00000001000e745c ruby`rb_gc_obj_free(objspace=0x000000012500c400, obj=4754039232) at gc.c:1282:9
    frame #8: 0x00000001000e70d4 ruby`gc_sweep_plane(objspace=0x000000012500c400, heap=&lt;unavailable&gt;, p=4754039232, bitset=4095, ctx=0x00000001305b76e8) at default.c:3482:21
    frame #9: 0x00000001000e6e9c ruby`gc_sweep_page(objspace=0x000000012500c400, heap=0x000000012500c540, ctx=0x00000001305b76e8) at default.c:3567:13
    frame #10: 0x00000001000e51d0 ruby`gc_sweep_step(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:3848:9
    frame #11: 0x00000001000e1880 ruby`gc_continue [inlined] gc_sweep_continue(objspace=0x000000012500c400, sweep_heap=0x000000012500c540) at default.c:3931:13
    frame #12: 0x00000001000e1754 ruby`gc_continue(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2037:9
    frame #13: 0x00000001000e10bc ruby`newobj_cache_miss [inlined] heap_prepare(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2056:5
    frame #14: 0x00000001000e1074 ruby`newobj_cache_miss [inlined] heap_next_free_page(objspace=0x000000012500c400, heap=0x000000012500c540) at default.c:2280:9
    frame #15: 0x00000001000e106c ruby`newobj_cache_miss(objspace=0x000000012500c400, cache=0x0000600001b00300, heap_idx=2, vm_locked=false) at default.c:2387:38
    frame #16: 0x00000001000e0d28 ruby`newobj_alloc(objspace=&lt;unavailable&gt;, cache=&lt;unavailable&gt;, heap_idx=&lt;unavailable&gt;, vm_locked=&lt;unavailable&gt;) at default.c:2411:15 [artificial]
    frame #17: 0x00000001000d7214 ruby`newobj_of [inlined] rb_gc_impl_new_obj(objspace_ptr=&lt;unavailable&gt;, cache_ptr=&lt;unavailable&gt;, klass=&lt;unavailable&gt;, flags=&lt;unavailable&gt;, wb_protected=&lt;unavailable&gt;, alloc_size=&lt;unavailable&gt;) at default.c:2490:15
    frame #18: 0x00000001000d719c ruby`newobj_of(cr=&lt;unavailable&gt;, klass=4313971728, flags=258, wb_protected=&lt;unavailable&gt;, size=&lt;unavailable&gt;) at gc.c:995:17
    frame #19: 0x00000001000d73ec ruby`rb_wb_protected_newobj_of(ec=&lt;unavailable&gt;, klass=&lt;unavailable&gt;, flags=&lt;unavailable&gt;, size=&lt;unavailable&gt;) at gc.c:1044:12 [artificial]
    frame #20: 0x0000000100032d34 ruby`class_alloc0(type=&lt;unavailable&gt;, klass=4313971728, namespaceable=&lt;unavailable&gt;) at class.c:803:5
```</pre>
</div>
</content>
</entry>
<entry>
<title>Initialize class dup/clone before calling initialize_dup/initialize_clone</title>
<updated>2025-08-30T18:24:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2025-08-30T18:24:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5c7dfe85a1dc49334e2828791f0ade42eee662db'/>
<id>5c7dfe85a1dc49334e2828791f0ade42eee662db</id>
<content type='text'>
Previously, you could override the class initialize_dup/initialize_clone
method and the class hierarchy would not be set correctly inside the
method before calling super.

This removes Module#initialize_copy, and instead makes Object#dup/clone
call the underlying C function (rb_mod_init_copy) before calling the
appropriate initialize_dup/initialize_clone method.

This results in the following fixes:

* The appropriate initialize_dup method is called (dup on a class
  will respect superclass initialize_dup).

* Inside class initialize_dup/initialize_clone/initialize_copy,
  class ancestor hierarchy is correct.

* Calling singleton_class inside initialize_dup no longer raises
  a TypeError later in dup.

* Calling singleton_class.ancestors inside initialize_dup no
  longer results in missing ancestors.

Fixes [Bug #21538]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, you could override the class initialize_dup/initialize_clone
method and the class hierarchy would not be set correctly inside the
method before calling super.

This removes Module#initialize_copy, and instead makes Object#dup/clone
call the underlying C function (rb_mod_init_copy) before calling the
appropriate initialize_dup/initialize_clone method.

This results in the following fixes:

* The appropriate initialize_dup method is called (dup on a class
  will respect superclass initialize_dup).

* Inside class initialize_dup/initialize_clone/initialize_copy,
  class ancestor hierarchy is correct.

* Calling singleton_class inside initialize_dup no longer raises
  a TypeError later in dup.

* Calling singleton_class.ancestors inside initialize_dup no
  longer results in missing ancestors.

Fixes [Bug #21538]</pre>
</div>
</content>
</entry>
<entry>
<title>Fix tests using assert_raise_with_message on US-ASCII systems</title>
<updated>2025-08-16T02:42:07+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-08-16T01:15:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=87c4ebd00115b9424f04813b4dd5f3d087a14eb9'/>
<id>87c4ebd00115b9424f04813b4dd5f3d087a14eb9</id>
<content type='text'>
On systems where the Encoding.default_internal defaults to US-ASCII instead
of UTF-8, some tests using assert_raise_with_message can fail since it no
longer changes Encoding.default_internal in 79f5202.

This tests explicitly uses EnvUtil.with_default_internal on systems where
these tests fail.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On systems where the Encoding.default_internal defaults to US-ASCII instead
of UTF-8, some tests using assert_raise_with_message can fail since it no
longer changes Encoding.default_internal in 79f5202.

This tests explicitly uses EnvUtil.with_default_internal on systems where
these tests fail.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove respond_to check from Class#bind_call</title>
<updated>2025-05-12T21:10:29+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-04-15T01:02:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b0502e8f904f155ac077014077431ed5e54b9996'/>
<id>b0502e8f904f155ac077014077431ed5e54b9996</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>avoid calling ZALLOC after NEWOBJ_OF for RClass: need to return RClass not promoted</title>
<updated>2025-05-11T14:32:50+00:00</updated>
<author>
<name>Satoshi Tagomori</name>
<email>tagomoris@gmail.com</email>
</author>
<published>2025-05-02T02:30:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f24ba27d6d88241f0560f12b0b2cb54d8cb40262'/>
<id>f24ba27d6d88241f0560f12b0b2cb54d8cb40262</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
