1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (rb_hash_aset): string key copying only happen if key is

an exact instance of String, not a subclass. based on a patch
  from Mike Gold <mike.gold.4433 at gmail.com> in [ruby-talk:322667].
  [incompatible] [ruby-talk:322417]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-12-18 08:05:17 +00:00
parent 85bae86cb6
commit 88cab63a07
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Thu Dec 18 17:00:56 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* hash.c (rb_hash_aset): string key copying only happen if key is
an exact instance of String, not a subclass. based on a patch
from Mike Gold <mike.gold.4433 at gmail.com> in [ruby-talk:322667].
[incompatible] [ruby-talk:322417]
Thu Dec 18 16:48:12 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/optparse/version.rb: remove variable shadowing to stop

2
hash.c
View file

@ -984,7 +984,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
{
rb_hash_modify(hash);
if (RHASH(hash)->ntbl->type == &identhash ||
TYPE(key) != T_STRING || st_lookup(RHASH(hash)->ntbl, key, 0)) {
rb_obj_class(key) != rb_cString || st_lookup(RHASH(hash)->ntbl, key, 0)) {
st_insert(RHASH(hash)->ntbl, key, val);
}
else {