1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* range.c (range_step): call to_int if step is not a numeric

value.  [ruby-dev:34575]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-05-02 08:31:04 +00:00
parent 3330ec6cff
commit f099a94afa
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Fri May 2 17:29:59 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* range.c (range_step): call to_int if step is not a numeric
value. [ruby-dev:34575]
Fri May 2 16:10:57 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* range.c (range_step): do not forcefully convert steps into

View file

@ -306,6 +306,9 @@ range_step(int argc, VALUE *argv, VALUE range)
}
else {
rb_scan_args(argc, argv, "01", &step);
if (!rb_obj_is_kind_of(step, rb_cNumeric)) {
step = rb_to_int(step);
}
if (rb_funcall(step, '<', 1, INT2FIX(0))) {
rb_raise(rb_eArgError, "step can't be negative");
}