From: "Eregon (Benoit Daloze)" Date: 2022-03-10T15:14:30+00:00 Subject: [ruby-core:107830] [Ruby master Bug#18621] Fiber.yield loses the fact it was kwargs from Fiber#resume Issue #18621 has been updated by Eregon (Benoit Daloze). Note that kwargs are correctly passed through for Fiber.new: ```ruby Fiber.new do |*args, **kwargs| p kwargs # => {a: 1} end.resume(a: 1) ``` ---------------------------------------- Bug #18621: Fiber.yield loses the fact it was kwargs from Fiber#resume https://bugs.ruby-lang.org/issues/18621#change-96758 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-03-03T08:56:31Z master c1790f8c11) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: REQUIRED, 3.1: REQUIRED ---------------------------------------- ```ruby f = Fiber.new do args = Fiber.yield args end f.resume args = f.resume(a: 1) Hash.ruby2_keywords_hash?(args) # => false, but should be true, isn't it? ``` This also means if there is `foo(*args)` later and `foo` would require kwargs it would fail: ```ruby def foo(a: 1) = a f = Fiber.new do args = Fiber.yield args end f.resume args = f.resume(a: 1) foo(*args) # => # -:1:in `foo': wrong number of arguments (given 1, expected 0) (ArgumentError) # from -:9:in `
' ``` cc @jeremyevans0 @mame -- https://bugs.ruby-lang.org/ Unsubscribe: