diff options
author | Étienne Barrié <[email protected]> | 2024-05-27 11:22:39 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-05-28 07:32:33 +0200 |
commit | 1376881e9afe6ff673f64afa791cf30f57147ee2 (patch) | |
tree | a5ad297473381ac00c593ca2ca1ef93381fd3a00 /string.c | |
parent | 2114d0af1e5790da365584a38ea7ee58670dc11b (diff) |
Stop marking chilled strings as frozen
They were initially made frozen to avoid false positives for cases such
as:
str = str.dup if str.frozen?
But this may cause bugs and is generally confusing for users.
[Feature #20205]
Co-authored-by: Jean Boussier <[email protected]>
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2453,6 +2453,9 @@ rb_check_lockedtmp(VALUE str) static inline void str_modifiable(VALUE str) { + if (CHILLED_STRING_P(str)) { + CHILLED_STRING_MUTATED(str); + } rb_check_lockedtmp(str); rb_check_frozen(str); } @@ -3053,7 +3056,7 @@ rb_str_freeze(VALUE str) static VALUE str_uplus(VALUE str) { - if (OBJ_FROZEN(str)) { + if (OBJ_FROZEN(str) || CHILLED_STRING_P(str)) { return rb_str_dup(str); } else { |