This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 5f4ba59056 GH-47232: [Ruby] Suppress warnings in test with Ruby 3.5
(#47233)
5f4ba59056 is described below
commit 5f4ba59056ec091570fa58603af02dd1200ff718
Author: Sutou Kouhei <[email protected]>
AuthorDate: Tue Aug 5 15:33:19 2025 +0900
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 <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
---
ruby/red-arrow/test/test-buffer.rb | 4 +++-
ruby/red-arrow/test/test-ractor.rb | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ruby/red-arrow/test/test-buffer.rb
b/ruby/red-arrow/test/test-buffer.rb
index b47a1abbae..e2e5bd3da8 100644
--- a/ruby/red-arrow/test/test-buffer.rb
+++ b/ruby/red-arrow/test/test-buffer.rb
@@ -20,10 +20,12 @@ class BufferTest < Test::Unit::TestCase
test("GC") do
data = "Hello"
data_id = data.object_id
+ weak_map = ObjectSpace::WeakMap.new
+ weak_map[data_id] = data
_buffer = Arrow::Buffer.new(data)
data = nil
GC.start
- assert_equal("Hello", ObjectSpace._id2ref(data_id))
+ assert_equal("Hello", weak_map[data_id])
end
end
diff --git a/ruby/red-arrow/test/test-ractor.rb
b/ruby/red-arrow/test/test-ractor.rb
index daf674d135..2aef74d01a 100644
--- a/ruby/red-arrow/test/test-ractor.rb
+++ b/ruby/red-arrow/test/test-ractor.rb
@@ -29,6 +29,11 @@ class RactorTest < Test::Unit::TestCase
recived_chunked_array.chunks
end
ractor.send(chunked_array)
- assert_equal([array], ractor.take)
+ unless ractor.respond_to?(:value) # For Ruby < 3.5
+ def ractor.value
+ take
+ end
+ end
+ assert_equal([array], ractor.value)
end
end