mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix ractor move of unshareable frozen objects
These objects didn't retain their frozen status after the move Bug [#19408]
This commit is contained in:
parent
1eb5c03fda
commit
38af38edcb
Notes:
git
2024-12-24 02:39:01 +00:00
2 changed files with 15 additions and 0 deletions
|
@ -752,6 +752,17 @@ assert_equal '[0, 1]', %q{
|
|||
end
|
||||
}
|
||||
|
||||
# unshareable frozen objects should still be frozen in new ractor after move
|
||||
assert_equal 'true', %q{
|
||||
r = Ractor.new do
|
||||
obj = receive
|
||||
{ frozen: obj.frozen? }
|
||||
end
|
||||
obj = [Object.new].freeze
|
||||
r.send(obj, move: true)
|
||||
r.take[:frozen]
|
||||
}
|
||||
|
||||
# move with yield
|
||||
assert_equal 'hello', %q{
|
||||
r = Ractor.new do
|
||||
|
|
4
ractor.c
4
ractor.c
|
@ -3581,6 +3581,10 @@ move_leave(VALUE obj, struct obj_traverse_replace_data *data)
|
|||
rb_replace_generic_ivar(v, obj);
|
||||
}
|
||||
|
||||
if (OBJ_FROZEN(obj)) {
|
||||
OBJ_FREEZE(v);
|
||||
}
|
||||
|
||||
// TODO: generic_ivar
|
||||
|
||||
ractor_moved_bang(obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue