1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Preserve the encoding of message from outer local variable

In the case of read-only but refering an unshareable object.
This commit is contained in:
Nobuyoshi Nakada 2021-10-29 21:40:11 +09:00
parent ec2e04c90d
commit 5e52fd4bd1
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 5 additions and 1 deletions

View file

@ -111,6 +111,10 @@ class TestISeq < Test::Unit::TestCase
assert_raise_with_message(ArgumentError, /\(#{name}\)/) do
Ractor.make_shareable(y)
end
y = eval("proc {#{name} = []; proc {|x| #{name}}}").call
assert_raise_with_message(Ractor::IsolationError, /`#{name}'/) do
Ractor.make_shareable(y)
end
end
def test_disasm_encoding

2
vm.c
View file

@ -1037,7 +1037,7 @@ env_copy(const VALUE *src_ep, VALUE read_only_variables)
if (!rb_ractor_shareable_p(v)) {
rb_raise(rb_eRactorIsolationError,
"can not make shareable Proc because it can refer unshareable object %"
PRIsVALUE" from variable `%s'", rb_inspect(v), rb_id2name(id));
"+" PRIsVALUE " from variable `%" PRIsVALUE "'", v, rb_id2str(id));
}
env_body[j] = v;
rb_ary_delete_at(read_only_variables, i);