summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index fc38f2f..3f278e0 100644
--- a/hash.c
+++ b/hash.c
@@ -1587,11 +1587,15 @@ VALUE
rb_hash_key_str(VALUE key)
{
VALUE k;
+ int not_tainted = !RB_OBJ_TAINTED(key);
- if (!RB_OBJ_TAINTED(key) &&
+ if (not_tainted &&
(k = fstring_existing_str(key)) != Qnil) {
return k;
}
+ else if(not_tainted) {
+ return rb_fstring(key);
+ }
else {
return rb_str_new_frozen(key);
}