summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 03:26:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 03:26:27 +0000
commit06eece87c6e8b969a73aa80ac659f09eb9dcbbcb (patch)
treeb57bf04c11ecbe8f78d373186b23ddcd039b606c
parent012faccf040344360801b0fa77e85f9c8a3a4b2c (diff)
enumerator.c: force hash values fixable
* enumerator.c (arith_seq_hash): force hash values fixable on LLP64 environment. [ruby-core:92190] [Bug #15755] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--enumerator.c2
-rw-r--r--test/ruby/test_arithmetic_sequence.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c
index cfc6a5dd98..9a0f9265c2 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -3345,7 +3345,7 @@ arith_seq_hash(VALUE self)
hash = rb_hash_uint(hash, NUM2LONG(v));
hash = rb_hash_end(hash);
- return LONG2FIX(hash);
+ return ST2FIX(hash);
}
#define NUM_GE(x, y) RTEST(rb_num_coerce_relop((x), (y), idGE))
diff --git a/test/ruby/test_arithmetic_sequence.rb b/test/ruby/test_arithmetic_sequence.rb
index 5817631944..45a0ab9222 100644
--- a/test/ruby/test_arithmetic_sequence.rb
+++ b/test/ruby/test_arithmetic_sequence.rb
@@ -127,6 +127,7 @@ class TestArithmeticSequence < Test::Unit::TestCase
assert_equal(seq.hash, seq.hash)
assert_equal(seq.hash, 1.step.hash)
assert_equal(seq.hash, 1.step(nil).hash)
+ assert_kind_of(String, seq.hash.to_s)
end
def test_first