summaryrefslogtreecommitdiff
path: root/enumerator.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-12 05:35:46 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-12 05:35:46 +0000
commit0a0f8238d02a2dfff4cd2892408e14cb826cec7e (patch)
tree8904010c4daedbbdc0d50480d5e652e63f426df3 /enumerator.c
parent0f6708eb9b0aa0826740656d52f6c65b32c2ec77 (diff)
enumerator.c: Fix ArithmeticSequence for complex step
Make sure Enumerator::ArithmeticSequence#each to work well for a complex step value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r--enumerator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/enumerator.c b/enumerator.c
index 2c115aa..46ded37 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -2661,7 +2661,8 @@ arith_seq_each(VALUE self)
s = arith_seq_step(self);
x = arith_seq_exclude_end_p(self);
- if (ruby_float_step(c, e, s, x, TRUE)) {
+ if (RB_TYPE_P(c, T_FLOAT) && RB_TYPE_P(s, T_FLOAT) &&
+ ruby_float_step(c, e, s, x, TRUE)) {
return self;
}