Bug #8139

keyreq and keyrest

Added by no6v (Nobuhiro IMAI) over 7 years ago. Updated over 7 years ago.

Target version:
ruby -v:


Passing a hash without required key (:keyreq) to a method which takes keyreq: and **keyrest,
then a same hash is set to both keyreq and keyrest.

def m(keyreq:, **keyrest)
[keyreq, keyrest]

m(keyreq: 1, keyrest: 2) # => [1, {:keyrest => 2}] OK
m(unknown: 3) # => [{:unknown=>3}, {:unknown=>3}] ??


Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39869.
Nobuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

vm_insnhelper.c: check required kwarg with resthash

  • vm_insnhelper.c (vm_callee_setup_keyword_arg): should check required keyword arguments even if rest hash is defined. [ruby-core:53608] [Bug #8139]

Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Category deleted (core)
  • Status changed from Closed to Assigned
  • Assignee set to nagachika (Tomoyuki Chikanaga)

I think this is definitely a bugfix. I'll backport r39869.


Updated by nagachika (Tomoyuki Chikanaga) over 7 years ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport200 to Ruby master
  • Status changed from Assigned to Closed
  • Assignee changed from nagachika (Tomoyuki Chikanaga) to nobu (Nobuyoshi Nakada)

It is a bugfix about require keyword arguments which is a new feature of 2.1. [Feature #7701]
No need to backport. sorry.

Also available in: Atom PDF