[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92831] [Ruby trunk Bug#15872] CSV.parse omits close call when block is given – intended or bug?
From:
kou@...
Date:
2019-05-24 21:45:50 UTC
List:
ruby-core #92831
Issue #15872 has been updated by kou (Kouhei Sutou).
Assignee set to kou (Kouhei Sutou)
`CSV.parse` expects a `String` as the input. So `close` isn't necessary.
If you have a problem case, could you report this with the problem case to https://github.com/ruby/csv/issues ?
----------------------------------------
Bug #15872: CSV.parse omits close call when block is given – intended or bug?
https://bugs.ruby-lang.org/issues/15872#change-78210
* Author: sos4nt (Stefan Schüßler)
* Status: Rejected
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version:
* ruby -v:
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The current implementation of `CSV.parse` doesn't call `close` when a block is given:
```ruby
def self.parse(*args, &block)
csv = new(*args)
return csv.each(&block) if block_given?
begin
csv.read
ensure
csv.close # <- never gets here if block is given
end
end
```
A possible fix would be:
```ruby
def self.parse(*args, &block)
csv = new(*args)
if block_given?
csv.each(&block)
else
csv.read
end
ensure
csv.close
end
```
But I'm not sure if this behavior might be intended, given that Ruby's CSV library is quite mature.
Am I missing a use case or is this actually a bug?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>