diff --git a/ChangeLog b/ChangeLog index 520fcbdd4c..423dea433b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 9 20:58:16 2008 Tanaka Akira + + * array.c (rb_ary_fill): don't raise even if length is negative. + [ruby-core:17483], [ruby-core:17661] + Wed Jul 9 20:36:31 2008 Nobuyoshi Nakada * thread_{pthread,win32}.c (native_sleep): wait until timed out. diff --git a/array.c b/array.c index 646ea16526..2d5b5ace39 100644 --- a/array.c +++ b/array.c @@ -2141,10 +2141,12 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary) if (beg < 0) beg = 0; } len = NIL_P(arg2) ? RARRAY_LEN(ary) - beg : NUM2LONG(arg2); - if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len); break; } rb_ary_modify(ary); + if (len < 0) { + return ary; + } if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) { rb_raise(rb_eArgError, "argument too big"); }