Project

General

Profile

Actions

Bug #1298

closed

wrong value for Hash of Hash

Added by phasis68 (Heesob Park) about 12 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
Backport:
[ruby-core:22921]

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

Actions #1

Updated by akr (Akira Tanaka) almost 12 years ago

=begin
Possible idea is ArgumentError for cyclic hash key.
=end

Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r24149.
=end

Actions

Also available in: Atom PDF