Skip to content

Commit 5f4ba59

Browse files
authored
GH-47232: [Ruby] Suppress warnings in test with Ruby 3.5 (#47233)
### Rationale for this change ```text ruby/red-arrow/test/test-buffer.rb:26: warning: ObjectSpace._id2ref is deprecated ``` ```text ruby/red-arrow/test/test-ractor.rb:32: warning: Ractor#take was deprecated and use Ractor#value instead. This method will be removed after the end of Aug 2025 ``` ### What changes are included in this PR? * Use `ObjectSpace::WeakMap` instead of `ObjectSapce._id2ref` * Use `Ractor#value` instead of `Ractor#take` ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #47232 Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent d9618fe commit 5f4ba59

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ruby/red-arrow/test/test-buffer.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ class BufferTest < Test::Unit::TestCase
2020
test("GC") do
2121
data = "Hello"
2222
data_id = data.object_id
23+
weak_map = ObjectSpace::WeakMap.new
24+
weak_map[data_id] = data
2325
_buffer = Arrow::Buffer.new(data)
2426
data = nil
2527
GC.start
26-
assert_equal("Hello", ObjectSpace._id2ref(data_id))
28+
assert_equal("Hello", weak_map[data_id])
2729
end
2830
end
2931

ruby/red-arrow/test/test-ractor.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ class RactorTest < Test::Unit::TestCase
2929
recived_chunked_array.chunks
3030
end
3131
ractor.send(chunked_array)
32-
assert_equal([array], ractor.take)
32+
unless ractor.respond_to?(:value) # For Ruby < 3.5
33+
def ractor.value
34+
take
35+
end
36+
end
37+
assert_equal([array], ractor.value)
3338
end
3439
end

0 commit comments

Comments
 (0)