aboutsummaryrefslogtreecommitdiffstats
path: root/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/symbol.c b/symbol.c
index 4fe3adf724..65ffab0958 100644
--- a/symbol.c
+++ b/symbol.c
@@ -674,13 +674,14 @@ rb_str_intern(VALUE str)
#if USE_SYMBOL_GC
enc = rb_enc_get(str);
ascii = rb_usascii_encoding();
- if (enc != ascii) {
- if (sym_check_asciionly(str)) {
- str = rb_str_dup(str);
- rb_enc_associate(str, ascii);
- OBJ_FREEZE(str);
- enc = ascii;
- }
+ if (enc != ascii && sym_check_asciionly(str)) {
+ str = rb_str_dup(str);
+ rb_enc_associate(str, ascii);
+ OBJ_FREEZE(str);
+ enc = ascii;
+ }
+ else {
+ str = rb_str_new_frozen(str);
}
str = rb_fstring(str);
type = rb_str_symname_type(str, IDSET_ATTRSET_FOR_INTERN);