mark created frozen strings.

* hash.c (rb_hash_new_from_values_with_klass): before this fix,
  only a st table are filled with passed values. However, newly
  created frozen strings are not marked correctly only reference
  from st table. This patch marks such created frozen strings
  by Hash object which refers to the st table.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-04-21 11:02:10 +00:00
parent 34f1488895
commit a7db632088

5
hash.c
View File

@ -650,19 +650,22 @@ rb_hash_new_from_values_with_klass(long argc, const VALUE *argv, VALUE klass)
{
long i;
st_table *t;
VALUE v;
if (argc % 2) {
rb_raise(rb_eArgError, "odd number of arguments for Hash");
}
t = st_init_table_with_size(&objhash, argc / 2);
v = hash_alloc_from_st(klass, t);
for (i = 0; i < argc; /* */) {
VALUE key = argv[i++];
VALUE val = argv[i++];
hash_insert_raw(t, key, val);
}
return hash_alloc_from_st(klass, t);
return v;
}
VALUE