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 diff --git a/ractor.c b/ractor.c index 9a09312cf2..6b46d4ba95 100644 --- a/ractor.c +++ b/ractor.c @@ -2089,7 +2089,7 @@ rb_ractor_make_shareable(VALUE obj) { rb_obj_traverse(obj, make_shareable_check_shareable, - mark_shareable, mark_shareable); + null_leave, mark_shareable); return obj; }