Bug #1298
closedwrong value for Hash of Hash
Description
=begin
I found wrong hash value for hash of hash in 1.9.1
In ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux]
irb(main):001:0> h = {}
=> {}
irb(main):002:0> h[1]=2
=> 2
irb(main):003:0> h[h]=3
=> 3
irb(main):004:0> h
=> {1=>2, {...}=>3}
irb(main):005:0> h[h]
=> 3
irb(main):006:0> h[h]=4
=> 4
irb(main):007:0> h
=> {1=>2, {...}=>4}
irb(main):008:0> h[h]
=> 4
In ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
irb(main):001:0> h = {}
=> {}
irb(main):002:0> h[1]=2
=> 2
irb(main):003:0> h[h]=3
=> 3
irb(main):004:0> h
=> {1=>2, {...}=>3}
irb(main):005:0> h[h]
=> nil
irb(main):006:0> h[h]=4
=> 4
irb(main):007:0> h
=> {1=>2, {...}=>3, {...}=>4}
irb(main):008:0> h[h]
=> nil
=end
Updated by akr (Akira Tanaka) over 15 years ago
=begin
Possible idea is ArgumentError for cyclic hash key.
=end
Updated by nobu (Nobuyoshi Nakada) over 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r24149.
=end