diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-10 04:49:44 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-10 04:49:44 +0000 |
commit | 33791cd092488b6a9d7f9b78a9be312b1fccd713 (patch) | |
tree | 1ee784756c3550c20b99cf618326d591689cc849 /enumerator.c | |
parent | 3ef25ed7553b2151ce468054cb6d1e38f1fc2e52 (diff) |
enumerator.c: fix for non-integral argument for ArithmeticSequence#last
This fixes a bug of Enumerator::ArithmeticSequence#last in the case that
a non-integral argument is passed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/enumerator.c b/enumerator.c index 9e48fddae3..35775b864b 100644 --- a/enumerator.c +++ b/enumerator.c @@ -2495,6 +2495,9 @@ arith_seq_last(int argc, VALUE *argv, VALUE self) } rb_scan_args(argc, argv, "1", &nv); + if (!RB_INTEGER_TYPE_P(nv)) { + nv = rb_to_int(nv); + } if (RTEST(rb_int_gt(nv, len))) { nv = len; } |