From: skalee@... Date: 2016-03-26T17:12:22+00:00 Subject: [ruby-core:74593] [Ruby trunk Bug#12198] Hash#== sometimes returns false incorrectly Issue #12198 has been updated by Sebastian Skalacki. Tsuyoshi Sawada wrote: > I thought you had previously written: > > >Actually it has nothing to do with sets I've reported it as an issue with `Hash#==` method initially. The lack of `Set#rehash` has been pointed out by others and I agree that it should be implemented. > Furthermore, is this even a bug? The documentation on `Hash#==` clearly describes different behaviour, therefore I've reported it as a bug. ---------------------------------------- Bug #12198: Hash#== sometimes returns false incorrectly https://bugs.ruby-lang.org/issues/12198#change-57722 * Author: Sebastian Skalacki * Status: Assigned * Priority: Normal * Assignee: Akinori MUSHA * ruby -v: ruby 2.4.0dev (2016-03-11 trunk 54086) [x86_64-darwin14] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Hi! Sorry for lack of the accuracy in the bug title. I have some trouble with pinpointing the issue. According to documentation, "two hashes are equal if they each contain the same number of keys and if each key-value pair is equal to (according to Object#==) the corresponding elements in the other hash." I was able to produce two hashes which satisfy this condition, however the method returns false. In other words, following happens: ~~~ e.class #=> Hash r.class #=> Hash e.size == r.size #=> true e.each_pair.to_a == r.each_pair.to_a #=> true e == r #=> false ~~~ That happens in Ruby 1.9.3, 2.3, 2.4 and probably in other versions as well. Pure Ruby, no gem could interfere. Happy Easter ]:-> ---Files-------------------------------- problem.rb (1.69 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: