diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-10-20 15:16:21 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-10-27 01:45:57 +0900 |
commit | 7ad56fd87b35abf4933e0146761df91e9ec9890a (patch) | |
tree | 36f7ec5b355f4ba7442d228fbb2a5a2f6f87be91 /re.c | |
parent | f8d264fdfd4486062c2d526c37e05c4e5c73850d (diff) |
freeze dynamic regexp literals
Regexp literals are frozen, and also dynamically comppiled Regexp
literals (/#{expr}/) are frozen.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3676
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 |