diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2025-08-31 03:24:25 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-30 11:24:25 -0700 |
| commit | 5c7dfe85a1dc49334e2828791f0ade42eee662db (patch) | |
| tree | 6df4cea1d0df4a839f893e2620c37c42c770ad9c /test/ruby/test_array.rb | |
| parent | dd4e7801f3f2b7e258016b8e22c6d8870516166b (diff) | |
Initialize class dup/clone before calling initialize_dup/initialize_clone
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]
Diffstat (limited to 'test/ruby/test_array.rb')
0 files changed, 0 insertions, 0 deletions
