gitlab-build-images/patches/ruby/3.0.2/dont_alias_array_size.patch
Matthias Kaeppler c87c1d58bf Add Ruby 3.0.2 patches to fix method override bug
These patches are necessary to fix https://bugs.ruby-lang.org/issues/17725
which is unreleased.

This is currently breaking our Ruby 3 build, so until 3.0.3 is out
let's apply these independently.
2021-08-12 15:31:46 +02:00

22 lines
956 B
Diff

commit fa0279d947c3962c3f8c32852278d3ebb964cb19
Author: Koichi Sasada <ko1@atdot.net>
Date: Wed Jul 28 13:40:30 2021 +0900
should not share same `def` for specialized method
Because the key of redefine table is `def`, `def` should be
unique for each optimized method (`alias` is not allowed).
diff --git a/array.c b/array.c
index 3cb57a0872..36f712bcac 100644
--- a/array.c
+++ b/array.c
@@ -8384,7 +8384,7 @@ Init_Array(void)
rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
rb_define_method(rb_cArray, "reverse_each", rb_ary_reverse_each, 0);
rb_define_method(rb_cArray, "length", rb_ary_length, 0);
- rb_define_alias(rb_cArray, "size", "length");
+ rb_define_method(rb_cArray, "size", rb_ary_length, 0);
rb_define_method(rb_cArray, "empty?", rb_ary_empty_p, 0);
rb_define_method(rb_cArray, "find_index", rb_ary_index, -1);
rb_define_method(rb_cArray, "index", rb_ary_index, -1);