summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorÉtienne Barrié <[email protected]>2024-05-27 11:22:39 +0200
committerJean Boussier <[email protected]>2024-05-28 07:32:33 +0200
commit1376881e9afe6ff673f64afa791cf30f57147ee2 (patch)
treea5ad297473381ac00c593ca2ca1ef93381fd3a00 /string.c
parent2114d0af1e5790da365584a38ea7ee58670dc11b (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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 9f7c163a81..d43a6391be 100644
--- a/string.c
+++ b/string.c
@@ -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 {