summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-19 06:38:58 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-22 00:03:00 +0900
commita2950369bd8a5866092f6badf59b0811653a6092 (patch)
treeb8933f0f3f87618c04290e420222daef3a63e68d /bootstraptest
parentc7a5cc2c3098ea74343a0dbab36b3a65bc7a4144 (diff)
TracePoint.new(&block) should be ractor-local
TracePoint should be ractor-local because the Proc can violate the Ractor-safe.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3943
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_ractor.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb
index 797ad0a3ee..a853e91416 100644
--- a/bootstraptest/test_ractor.rb
+++ b/bootstraptest/test_ractor.rb
@@ -1199,6 +1199,19 @@ assert_equal '[false, false, true, true]', %q{
r
}
+# TracePoint with normal Proc should be Ractor local
+assert_equal '[4, 8]', %q{
+ rs = []
+ TracePoint.new(:line){|tp| rs << tp.lineno if tp.path == __FILE__}.enable do
+ Ractor.new{ # line 4
+ a = 1
+ b = 2
+ }.take
+ c = 3 # line 8
+ end
+ rs
+}
+
# Ractor deep copies frozen objects (ary)
assert_equal '[true, false]', %q{
Ractor.new([[]].freeze) { |ary|