From e2c628583ebf1a5986da7b2ab6d3cb228a4ca025 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sun, 30 Aug 2020 19:14:34 +0900 Subject: Fix `mrb_ary_splat()` to copy the array always. --- src/array.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/array.c b/src/array.c index f80134de4..c33641264 100644 --- a/src/array.c +++ b/src/array.c @@ -1096,11 +1096,8 @@ mrb_ary_splat(mrb_state *mrb, mrb_value v) } mrb_ensure_array_type(mrb, ary); a = mrb_ary_ptr(ary); - if (mrb_frozen_p(a)) { - a = ary_dup(mrb, a); - return mrb_obj_value(a); - } - return ary; + a = ary_dup(mrb, a); + return mrb_obj_value(a); } static mrb_value -- cgit v1.2.3