diff options
author | Koichi Sasada <ko1@atdot.net> | 2021-12-09 03:58:44 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2021-12-09 16:20:04 +0900 |
commit | cce331272b07636d536c8227288ab3fbcf24e2aa (patch) | |
tree | 167882704bfd85c0573b46c2007116a503b8c153 /vm.c | |
parent | c5f68a9a24c4e25f551108bda4738b1000d7b197 (diff) |
`Ractor.make_shareable` checks proc's sefl
`Ractor.make_shareable(proc_obj)` raises an `IsolationError`
if the self of `proc_obj` is not a shareable object.
[Bug #18243]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5232
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1181,6 +1181,10 @@ rb_proc_ractor_make_shareable(VALUE self) rb_proc_t *proc = (rb_proc_t *)RTYPEDDATA_DATA(self); if (proc->block.type != block_type_iseq) rb_raise(rb_eRuntimeError, "not supported yet"); + if (!rb_ractor_shareable_p(vm_block_self(&proc->block))) { + rb_raise(rb_eRactorIsolationError, "Proc's self is not shareable"); + } + VALUE read_only_variables = Qfalse; if (iseq->body->outer_variables) { |