summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-11-30 15:51:30 -0500
committerMarc-André Lafortune <github@marc-andre.ca>2020-11-30 19:33:37 -0500
commite25165b3fc72166a85ed10e49609153d72333388 (patch)
tree4217620186b22442677853cfe0b880f98398a5a0 /bootstraptest
parent750e2d9e5ef40f3d69cee957c263a925ff3a3ad6 (diff)
Fix `Ractor.make_shareable` for recursive structures with unfreezable components
Followup to #3823
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3827
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 6bd00d546f..7ab6a08875 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -984,6 +984,17 @@ assert_equal '[false, false]', %q{
[Ractor.shareable?(x), Ractor.shareable?(y)]
}
+# Ractor.make_shareable(recursive_objects)
+assert_equal '[:ok, false, false]', %q{
+ o = Object.new
+ def o.freeze; raise; end
+ y = []
+ x = [y, o].freeze
+ y << x
+ y.freeze
+ [(Ractor.make_shareable(x) rescue :ok), Ractor.shareable?(x), Ractor.shareable?(y)]
+}
+
# define_method() can invoke different Ractor's proc if the proc is shareable.
assert_equal '1', %q{
class C