[#97536] [Ruby master Bug#16694] JIT vs hardened GCC with PCH — v.ondruch@...
Issue #16694 has been reported by vo.x (Vit Ondruch).
11 messages
2020/03/18
[ruby-core:97523] [Ruby master Bug#12706] Hash#each yields inconsistent number of args
From:
matz@...
Date:
2020-03-16 08:30:11 UTC
List:
ruby-core #97523
Issue #12706 has been updated by matz (Yukihiro Matsumoto).
It was caused by the optimization introduced in 2.1. It should check if a block is a lambda before making optimization.
We worry about compatibility but let's fix it in 2.8(3.0) and see it can cause problems. Please mark the change as **experimental** .
Matz.
----------------------------------------
Bug #12706: Hash#each yields inconsistent number of args
https://bugs.ruby-lang.org/issues/12706#change-84677
* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
```ruby
def foo(a, b)
p [a, b]
end
def bar(a, b = 2)
p [a, b]
end
foo_lambda = method(:foo).to_proc
bar_lambda = method(:bar).to_proc
{a: 1}.each(&foo_lambda)
{a: 1}.each(&bar_lambda)
```
From #12705, yielding to method lambdas uses lambda/method arg semnatics
the yield to foo produces `[:a, 1]` suggesting that each is yielding two values `yield key, value`
but yield to bar produces `[[:a, 1], 2]` suggesting that each is yielding one value `yield [key, value]`
it would be better if you always knew what to expect from it
--
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>