Bug #10699
closedm(*a, **b) doesn't recognize integer options.
Description
It seems a method defined as m(*a, **b) doesn't recognize integer options.
% ./ruby -v -e '
def m(*a, **b)
p [a, b]
end
m(1, 2 => 3)
m(1, :foo => 3)
'
ruby 2.3.0dev (2015-01-06 trunk 49159) [x86_64-linux]
[[1, {2=>3}], {}]
[[1], {:foo=>3}]
I think the result should be follows.
[[1], {2=>3}]
[[1], {:foo=>3}]
I found this problem by https://github.com/ruby/ruby/pull/808
Updated by sawa (Tsuyoshi Sawada) almost 10 years ago
I thought that was a feature. I proposed to extend the use of double splat, and a patch has already been provided by Nobu in #10118.
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
#10118 is only for splat, not rest keywords argument.
Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
- Related to Feature #10118: Double splat for non-symbol keys added
Updated by akr (Akira Tanaka) almost 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r49173.
- lib/open3.rb: Open3 properly passes non-keyword hash args to spawn.
Fixed by Josh Cheek. [Fix GH-808]
Related to [ruby-core:67347] [Bug #10699]
Updated by akr (Akira Tanaka) almost 10 years ago
- Status changed from Closed to Feedback
I didn't know this keyword arguments behavior.
Hm. I'm not sure the current behavior is good or not.
Anyway open3 has the problem since Ruby 2.1 and I don't expect Ruby 2.1 changes the keyword arguments behavior.
So I committed r49173 to fix open3 and it should be backportable.
Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: UNKNOWN
Thank you akr san for your consideration about backports.
I'll fill Backport field with 2.1: REQUIRED only for r49173.
Updated by jeremyevans0 (Jeremy Evans) about 5 years ago
- Status changed from Feedback to Closed