From 2e770cdf773d79327cfdeb8178a1cb9b340f4560 Mon Sep 17 00:00:00 2001 From: TOMITA Masahiro Date: Thu, 27 Nov 2025 11:10:43 +0900 Subject: [PATCH 1/3] Fix argument handling in `IO::Buffer#each_byte` (#15309) The method incorrectly ignored its first argument and treated the second argument as offset and the third as count. This change makes the first argument be treated as offset and the second as count. Also fix incorrect block parameter in comments. --- io_buffer.c | 4 ++-- test/ruby/test_io_buffer.rb | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/io_buffer.c b/io_buffer.c index abe7832bee829a..89f169176f48b5 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -2231,7 +2231,7 @@ io_buffer_values(int argc, VALUE *argv, VALUE self) /* * call-seq: - * each_byte([offset, [count]]) {|offset, byte| ...} -> self + * each_byte([offset, [count]]) {|byte| ...} -> self * each_byte([offset, [count]]) -> enumerator * * Iterates over the buffer, yielding each byte starting from +offset+. @@ -2255,7 +2255,7 @@ io_buffer_each_byte(int argc, VALUE *argv, VALUE self) rb_io_buffer_get_bytes_for_reading(self, &base, &size); size_t offset, count; - io_buffer_extract_offset_count(RB_IO_BUFFER_DATA_TYPE_U8, size, argc-1, argv+1, &offset, &count); + io_buffer_extract_offset_count(RB_IO_BUFFER_DATA_TYPE_U8, size, argc, argv, &offset, &count); for (size_t i = 0; i < count; i++) { unsigned char *value = (unsigned char *)base + i + offset; diff --git a/test/ruby/test_io_buffer.rb b/test/ruby/test_io_buffer.rb index 997ed52640fb0d..1e4a6e2fd86c40 100644 --- a/test/ruby/test_io_buffer.rb +++ b/test/ruby/test_io_buffer.rb @@ -473,6 +473,7 @@ def test_each_byte buffer = IO::Buffer.for(string) assert_equal string.bytes, buffer.each_byte.to_a + assert_equal string.bytes[3, 5], buffer.each_byte(3, 5).to_a end def test_zero_length_each_byte From 10522ca19739978911a490b0f948865d42e560f8 Mon Sep 17 00:00:00 2001 From: NAITOH Jun Date: Thu, 27 Nov 2025 14:07:54 +0900 Subject: [PATCH 2/3] [DOC] Include strscan/lib --- ext/.document | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/.document b/ext/.document index 0d6c97ff73e0d8..374abe65807482 100644 --- a/ext/.document +++ b/ext/.document @@ -90,6 +90,7 @@ readline/readline.c ripper/lib socket stringio/stringio.c +strscan/lib strscan/strscan.c syslog/syslog.c syslog/lib From 3e926cd5dd2dfb2176b7d65f802519586813284c Mon Sep 17 00:00:00 2001 From: Alex Clink Date: Fri, 14 Nov 2025 09:51:22 -0500 Subject: [PATCH 3/3] NEWS.md: fix wording about Ractor::Port --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index fa588780955227..41c87bf9478c71 100644 --- a/NEWS.md +++ b/NEWS.md @@ -242,7 +242,7 @@ The following bundled gems are updated. ## Compatibility issues -* The following methods were removed from Ractor due because of `Ractor::Port`: +* The following methods were removed from Ractor due to the addition of `Ractor::Port`: * `Ractor.yield` * `Ractor#take`