mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #19426] Fix endless Range#step
with #succ
method
This commit is contained in:
parent
8edd350bda
commit
da4464b824
Notes:
git
2023-02-09 14:05:28 +00:00
2 changed files with 45 additions and 1 deletions
6
range.c
6
range.c
|
@ -532,7 +532,11 @@ range_step(int argc, VALUE *argv, VALUE range)
|
|||
rb_raise(rb_eTypeError, "can't iterate from %s",
|
||||
rb_obj_classname(b));
|
||||
}
|
||||
range_each_func(range, step_i, (VALUE)iter);
|
||||
if (!NIL_P(e))
|
||||
range_each_func(range, step_i, (VALUE)iter);
|
||||
else
|
||||
for (;; b = rb_funcallv(b, id_succ, 0, 0))
|
||||
step_i(b, (VALUE)iter);
|
||||
}
|
||||
}
|
||||
return range;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue