From 937092b8203c373c919a6f307f91e17d4bec5bb1 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 13 Feb 2003 09:11:11 +0000 Subject: * range.c (range_step): step might be float 0 < x < 1. * eval.c (rb_thread_schedule): pause if no runnable thread when there's only one thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- range.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'range.c') diff --git a/range.c b/range.c index 585940af06..97b7d68138 100644 --- a/range.c +++ b/range.c @@ -242,13 +242,14 @@ range_step(argc, argv, range) } unit = NUM2LONG(step); - if (unit <= 0) { - rb_raise(rb_eArgError, "step can't be <= 0"); - } + if (unit < 0) { + rb_raise(rb_eArgError, "step can't be negative"); + } if (FIXNUM_P(b) && FIXNUM_P(e)) { /* fixnums are special */ long end = FIX2LONG(e); long i; + if (unit == 0) rb_raise(rb_eArgError, "step can't be 0"); if (!EXCL(range)) end += 1; for (i=FIX2LONG(b); i