From 037a9d06559e25cce2368979cecba710ddb4765d Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 10 Dec 2013 14:44:51 +0000 Subject: [PATCH] array.c, hash.c: add salt * array.c (rb_ary_hash): add salt to differentiate false and empty array. [ruby-core:58993] [Bug #9231] * hash.c (rb_any_hash, rb_hash_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ array.c | 1 + hash.c | 14 +++++++++----- test/ruby/test_array.rb | 2 ++ test/ruby/test_hash.rb | 2 ++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f45ae5932..66b79d950a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Dec 10 23:44:42 2013 Nobuyoshi Nakada + + * array.c (rb_ary_hash): add salt to differentiate false and empty + array. [ruby-core:58993] [Bug #9231] + + * hash.c (rb_any_hash, rb_hash_hash): ditto. + Tue Dec 10 18:16:09 2013 SHIBATA Hiroshi * man/ruby.1: [DOC] Use www.ruby-toolbox.com instead of RAA. diff --git a/array.c b/array.c index e6a45e86fd..b6d8a5584c 100644 --- a/array.c +++ b/array.c @@ -3792,6 +3792,7 @@ rb_ary_hash(VALUE ary) VALUE n; h = rb_hash_start(RARRAY_LEN(ary)); + h = rb_hash_uint(h, (st_index_t)rb_ary_hash); for (i=0; i2] h.shift assert_equal({}.hash, h.hash, '[ruby-core:38650]') + bug9231 = '[ruby-core:58993] [Bug #9231]' + assert_not_equal(0, @cls[].hash, bug9231) end def test_update2