Bug #13376 ยป 0001-hash.c-any_hash-make-static-symbol-hash-non-determin.patch
| hash.c | ||
|---|---|---|
|
if (a == Qundef) return 0;
|
||
|
if (STATIC_SYM_P(a)) {
|
||
|
hnum = a >> (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
|
||
|
hnum = rb_hash_start(hnum);
|
||
|
goto out;
|
||
|
}
|
||
|
else if (FLONUM_P(a)) {
|
||
| test/ruby/test_symbol.rb | ||
|---|---|---|
|
assert_equal str, str.to_sym.to_s
|
||
|
assert_not_predicate(str, :frozen?, bug11721)
|
||
|
end
|
||
|
def test_hash_nondeterministic
|
||
|
ruby = EnvUtil.rubybin
|
||
|
refute_equal `#{ruby} -e 'puts :foo.hash'`, `#{ruby} -e 'puts :foo.hash'`,
|
||
|
'[ruby-core:80430] [Bug #13376]'
|
||
|
sym = "dynsym_#{Random.rand(10000)}_#{Time.now}"
|
||
|
refute_equal `#{ruby} -e 'puts #{sym.inspect}.to_sym.hash'`,
|
||
|
`#{ruby} -e 'puts #{sym.inspect}.to_sym.hash'`
|
||
|
end
|
||
|
end
|
||
|
-
|
||