From 8247b8eddeb2a504a5c9776d1f77d413c8146897 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 1 Dec 2020 11:14:36 +0900 Subject: should not use rb_ary_modify() ractor_copy() used rb_ary_modify() to make sure this array is not sharing anything, but it also checks frozen flag. So frozen arrays raises an error. To solve this issue, this patch introduces new function rb_ary_cancel_sharing() which makes sure the array does not share another array and it doesn't check frozen flag. [Bug #17343] A test is quoted from https://github.com/ruby/ruby/pull/3817 --- internal/array.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'internal') diff --git a/internal/array.h b/internal/array.h index c9f2b47145..a7bf6d3868 100644 --- a/internal/array.h +++ b/internal/array.h @@ -29,6 +29,8 @@ VALUE rb_ary_tmp_new_fill(long capa); VALUE rb_ary_at(VALUE, VALUE); size_t rb_ary_memsize(VALUE); VALUE rb_to_array_type(VALUE obj); +void rb_ary_cancel_sharing(VALUE ary); + static inline VALUE rb_ary_entry_internal(VALUE ary, long offset); static inline bool ARY_PTR_USING_P(VALUE ary); static inline void RARY_TRANSIENT_SET(VALUE ary); -- cgit v1.2.3