[前][次][番号順一覧][スレッド一覧]

ruby-changes:69519

From: Nobuyoshi <ko1@a...>
Date: Fri, 29 Oct 2021 21:47:48 +0900 (JST)
Subject: [ruby-changes:69519] 5e52fd4bd1 (master): Preserve the encoding of message from outer local variable

https://git.ruby-lang.org/ruby.git/commit/?id=5e52fd4bd1

From 5e52fd4bd14a668dd7d85a67f824f2667c6d45ea Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 29 Oct 2021 21:40:11 +0900
Subject: Preserve the encoding of message from outer local variable

In the case of read-only but refering an unshareable object.
---
 test/ruby/test_iseq.rb | 4 ++++
 vm.c                   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index af92edc4942..34124ae9669 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -111,6 +111,10 @@ class TestISeq < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_iseq.rb#L111
     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
diff --git a/vm.c b/vm.c
index 18725de5a4a..8bf4db3c731 100644
--- a/vm.c
+++ b/vm.c
@@ -1037,7 +1037,7 @@ env_copy(const VALUE *src_ep, VALUE read_only_variables) https://github.com/ruby/ruby/blob/trunk/vm.c#L1037
                     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);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]