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

ruby-changes:70508

From: Sutou <ko1@a...>
Date: Fri, 24 Dec 2021 14:41:17 +0900 (JST)
Subject: [ruby-changes:70508] 56a5ae9f52 (master): [ruby/csv] Fix a bug that all of ARGF contents may not be consumed

https://git.ruby-lang.org/ruby.git/commit/?id=56a5ae9f52

From 56a5ae9f52920982a2f1571a57090772c94c8243 Mon Sep 17 00:00:00 2001
From: Sutou Kouhei <kou@c...>
Date: Fri, 3 Dec 2021 06:30:01 +0900
Subject: [ruby/csv] Fix a bug that all of ARGF contents may not be consumed

GitHub: fix GH-228

Reported by Rafael Navaza. Thanks!!!

https://github.com/ruby/csv/commit/81f595b6a1
---
 lib/csv/parser.rb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/csv/parser.rb b/lib/csv/parser.rb
index f87db3bb126..ef33a694781 100644
--- a/lib/csv/parser.rb
+++ b/lib/csv/parser.rb
@@ -768,7 +768,10 @@ class CSV https://github.com/ruby/ruby/blob/trunk/lib/csv/parser.rb#L768
         string = nil
         if @samples.empty? and @input.is_a?(StringIO)
           string = @input.read
-        elsif @samples.size == 1 and @input.respond_to?(:eof?) and @input.eof?
+        elsif @samples.size == 1 and
+              @input != ARGF and
+              @input.respond_to?(:eof?) and
+              @input.eof?
           string = @samples[0]
         end
         if string
-- 
cgit v1.2.1


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

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