ruby-changes:9322
From: matz <ko1@a...>
Date: Thu, 18 Dec 2008 17:05:33 +0900 (JST)
Subject: [ruby-changes:9322] Ruby:r20860 (trunk): * hash.c (rb_hash_aset): string key copying only happen if key is
matz 2008-12-18 17:05:17 +0900 (Thu, 18 Dec 2008) New Revision: 20860 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20860 Log: * 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] Modified files: trunk/ChangeLog trunk/hash.c Index: ChangeLog =================================================================== --- ChangeLog (revision 20859) +++ ChangeLog (revision 20860) @@ -1,3 +1,10 @@ +Thu Dec 18 17:00:56 2008 Yukihiro Matsumoto <matz@r...> + + * 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@r...> * lib/optparse/version.rb: remove variable shadowing to stop Index: hash.c =================================================================== --- hash.c (revision 20859) +++ hash.c (revision 20860) @@ -984,7 +984,7 @@ { 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 { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/