summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-09-02 03:19:13 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2024-09-02 03:19:13 -0700
commitcf9a6c2b63e6337a3f6ce76527446739e5aceb67 (patch)
tree08ec41bbd573dca488cf34b976f4bd13ec3e40ca
parentd83b5633b16f4ddcece4ff924f21c5a5851470cf (diff)
merge revision(s) a3562c2a0abf1c2bdd1d50377b4f929580782594: [Backport #20701]
Remove incorrect setting of KW_SPLAT_MUT flag Fixes [Bug #20701] Co-authored-by: Pablo Herrero <pablodherrero@gmail.com>
-rw-r--r--compile.c1
-rw-r--r--test/ruby/test_call.rb12
-rw-r--r--version.h2
3 files changed, 13 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 3ecb548859..03dd85a629 100644
--- a/compile.c
+++ b/compile.c
@@ -6105,7 +6105,6 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
if (kwnode) {
// kwsplat
*flag_ptr |= VM_CALL_KW_SPLAT;
- *flag_ptr |= VM_CALL_KW_SPLAT_MUT;
compile_hash(iseq, args, kwnode, TRUE, FALSE);
argc += 1;
}
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 09146efa41..7c914b5c1a 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -327,6 +327,18 @@ class TestCall < Test::Unit::TestCase
assert_equal Hash, f(*[], **o).class
end
+ def test_call_args_splat_with_pos_arg_kw_splat_is_not_mutable
+ o = Object.new
+ def o.foo(a, **h)= h[:splat_modified] = true
+
+ a = []
+ b = {splat_modified: false}
+
+ o.foo(*a, :x, **b)
+
+ assert_equal({splat_modified: false}, b)
+ end
+
def test_kwsplat_block_order
o = Object.new
ary = []
diff --git a/version.h b/version.h
index ea11e92a61..8cdae0c1aa 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 98
+#define RUBY_PATCHLEVEL 99
#include "ruby/version.h"
#include "ruby/internal/abi.h"