[#107867] Fwd: [ruby-cvs:91197] 8f59482f5d (master): add some tests for Unicode Version 14.0.0 — Martin J. Dürst <duerst@...>
To everybody taking care of continuous integration:
3 messages
2022/03/13
[#108090] [Ruby master Bug#18666] No rule to make target 'yaml/yaml.h', needed by 'api.o' — duerst <noreply@...>
Issue #18666 has been reported by duerst (Martin D端rst).
7 messages
2022/03/28
[#108117] [Ruby master Feature#18668] Merge `io-nonblock` gems into core — "Eregon (Benoit Daloze)" <noreply@...>
Issue #18668 has been reported by Eregon (Benoit Daloze).
22 messages
2022/03/30
[ruby-core:108028] [Ruby master Bug#18635] Enumerable#inject without block/symbol will return values or raise LocalJumpError
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2022-03-22 20:55:59 UTC
List:
ruby-core #108028
Issue #18635 has been updated by jeremyevans0 (Jeremy Evans).
The call-seq for inject does not show usage without an argument or block, so I think it is reasonable to consider this as a bug, and it seems more likely to be a code bug than a doc bug. It's problematic that no error is raised when called on an enumerable with one or two elements, since that is likely to lead to cases that do not raise errors during testing, but raise errors in real world environments.
LocalJumpError is raised when there is an attempt to yield to a block, but no block was passed. `Enumerable#inject` with zero or 1 arguments does not attempt to yield to a block, so it doesn't make sense to raise LocalJumpError. I think ArgumentError if passed no arguments and no block is a better fit. I submitted a pull request for that: https://github.com/ruby/ruby/pull/5690
----------------------------------------
Bug #18635: Enumerable#inject without block/symbol will return values or raise LocalJumpError
https://bugs.ruby-lang.org/issues/18635#change-96987
* Author: bjfish (Brandon Fish)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.3
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
The following shows inconsistent behavior when no block/symbol are provided to inject.
``` ruby
irb(main):002:0> {}.inject
=> nil
irb(main):003:0> {one: 1}.inject
=> [:one, 1]
irb(main):004:0> {one: 1, two: 2}.inject
(irb):4:in `each': no block given (LocalJumpError)
irb(main):005:0> [].inject
=> nil
irb(main):006:0> [1].inject
=> 1
irb(main):007:0> [1, 2].inject
(irb):7:in `each': no block given (LocalJumpError)
```
I would expect the results to be consistent by always raising a LocalJumpError or raising an ArgumentError when no block and symbol are given.
--
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>