ruby-changes:57601
From: Yusuke <ko1@a...>
Date: Fri, 6 Sep 2019 15:15:12 +0900 (JST)
Subject: [ruby-changes:57601] 70f2780892 (master): vm_call_bmethod should not drop the empty keyword hash
https://git.ruby-lang.org/ruby.git/commit/?id=70f2780892 From 70f2780892330f8d1b612002c437fc2ca739fc7f Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 5 Sep 2019 18:57:19 +0900 Subject: vm_call_bmethod should not drop the empty keyword hash Similar to 38e9c1bc35d5549575fbb263afff560e97db068e diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 3c486a4..dc450c0 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -733,7 +733,9 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L733 define_method(:m) {|arg, **opt| [arg, opt] } end assert_raise(ArgumentError) { c.m(**{}) } - assert_raise(ArgumentError) { c.m(**kw) } + assert_warn(/The keyword argument is passed as the last hash parameter/m) do + assert_equal([kw, kw], c.m(**kw)) + end assert_warn(/The keyword argument is passed as the last hash parameter/m) do assert_equal([h, kw], c.m(**h)) end diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 70fbb49..227ec2e 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2279,7 +2279,7 @@ vm_call_bmethod(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct rb_c https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2279 VALUE *argv; int argc; - CALLER_SETUP_ARG(cfp, calling, ci, 1); + CALLER_SETUP_ARG(cfp, calling, ci, 0); argc = calling->argc; argv = ALLOCA_N(VALUE, argc); MEMCPY(argv, cfp->sp - argc, VALUE, argc); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/