ruby-changes:38539
From: nagachika <ko1@a...>
Date: Sun, 24 May 2015 02:02:32 +0900 (JST)
Subject: [ruby-changes:38539] nagachika:r50620 (ruby_2_2): merge revision(s) 50182, 50183: [Backport #11035]
nagachika 2015-05-24 02:02:11 +0900 (Sun, 24 May 2015) New Revision: 50620 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50620 Log: merge revision(s) 50182,50183: [Backport #11035] * hash.c (rb_any_hash): Symbols are compared by the identities always. [ruby-core:68767] [Bug #11035] * test/ruby/test_symbol.rb: fix syntax error. Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/hash.c branches/ruby_2_2/test/ruby/test_symbol.rb branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 50619) +++ ruby_2_2/ChangeLog (revision 50620) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sun May 24 02:02:00 2015 Koichi Sasada <ko1@a...> + + * test/ruby/test_symbol.rb: fix syntax error. + +Sun May 24 02:02:00 2015 Nobuyoshi Nakada <nobu@r...> + + * hash.c (rb_any_hash): Symbols are compared by the identities + always. [ruby-core:68767] [Bug #11035] + Sun May 24 02:01:07 2015 Nobuyoshi Nakada <nobu@r...> * hash.c (rb_any_hash): use same hash values with Float#hash so Index: ruby_2_2/hash.c =================================================================== --- ruby_2_2/hash.c (revision 50619) +++ ruby_2_2/hash.c (revision 50620) @@ -149,6 +149,9 @@ rb_any_hash(VALUE a) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/hash.c#L149 else if (BUILTIN_TYPE(a) == T_STRING) { hnum = rb_str_hash(a); } + else if (BUILTIN_TYPE(a) == T_SYMBOL) { + hnum = rb_objid_hash((st_index_t)a); + } else if (BUILTIN_TYPE(a) == T_FLOAT) { return rb_dbl_hash(rb_float_value(a)); } Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 50619) +++ ruby_2_2/version.h (revision 50620) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.3" #define RUBY_RELEASE_DATE "2015-05-24" -#define RUBY_PATCHLEVEL 116 +#define RUBY_PATCHLEVEL 117 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 5 Index: ruby_2_2/test/ruby/test_symbol.rb =================================================================== --- ruby_2_2/test/ruby/test_symbol.rb (revision 50619) +++ ruby_2_2/test/ruby/test_symbol.rb (revision 50620) @@ -267,4 +267,23 @@ class TestSymbol < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_symbol.rb#L267 200_000.times { |i| i.to_s.to_sym } end; end + + def test_hash_redefinition + assert_separately([], <<-'end;') + bug11035 = '[ruby-core:68767] [Bug #11035]' + class Symbol + def hash + raise + end + end + + h = {} + assert_nothing_raised(RuntimeError, bug11035) { + h[:foo] = 1 + } + assert_nothing_raised(RuntimeError, bug11035) { + h['bar'.to_sym] = 2 + } + end; + end end Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50182-50183 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/