summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--re.c4
-rw-r--r--tool/lib/test/unit.rb1
2 files changed, 4 insertions, 1 deletions
diff --git a/re.c b/re.c
index 020ba7b6d6..55b39bfdea 100644
--- a/re.c
+++ b/re.c
@@ -2944,7 +2944,9 @@ rb_reg_init_str_enc(VALUE re, VALUE s, rb_encoding *enc, int options)
MJIT_FUNC_EXPORTED VALUE
rb_reg_new_ary(VALUE ary, int opt)
{
- return rb_reg_new_str(rb_reg_preprocess_dregexp(ary, opt), opt);
+ VALUE re = rb_reg_new_str(rb_reg_preprocess_dregexp(ary, opt), opt);
+ rb_obj_freeze(re);
+ return re;
}
VALUE
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index 0cba377db2..ea31804fb0 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -125,6 +125,7 @@ module Test
filter = /\A(?=.*#{filter})(?!.*#{negative})/
end
if Regexp === filter
+ filter = filter.dup
# bypass conversion in minitest
def filter.=~(other) # :nodoc:
super unless Regexp === other