summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-01 11:14:36 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-01 13:18:32 +0900
commit8247b8eddeb2a504a5c9776d1f77d413c8146897 (patch)
treea0464f31f918b06b6d5a377aed8a3d173a61f9dc /bootstraptest
parentd2cfb5228a89678a712efd381e049391800373e1 (diff)
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
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3831
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 7ab6a08875..2ae6602c82 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -1022,6 +1022,13 @@ assert_equal 'can not make a Proc shareable because it accesses outer variables
end
}
+# Ractor deep copies frozen objects
+assert_equal '[true, false]', %q{
+ Ractor.new([[]].freeze) { |ary|
+ [ary.frozen?, ary.first.frozen? ]
+ }.take
+}
+
###
### Synchronization tests
###