summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--hash.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8e95318dbc..dac7aea01c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/hash.c b/hash.c
index 044964c809..f3bd0b66b8 100644
--- a/hash.c
+++ b/hash.c
@@ -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 {