From c8010fcec016ee89aa0c45fe31094b2db0023e5c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 28 Dec 2020 01:38:17 +0900 Subject: Dup kwrest hash when merging other keyword arguments [Bug #17481] --- compile.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 264c310012..370a1f4522 100644 --- a/compile.c +++ b/compile.c @@ -8157,6 +8157,10 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in if (local_body->param.flags.has_kwrest) { int idx = local_body->local_table_size - local_kwd->rest_start; ADD_GETLOCAL(args, line, idx, lvar_level); + if (local_kwd->num > 0) { + ADD_SEND(args, line, rb_intern("dup"), INT2FIX(0)); + flag |= VM_CALL_KW_SPLAT_MUT; + } } else { ADD_INSN1(args, line, newhash, INT2FIX(0)); -- cgit v1.2.3