ruby-changes:30843
From: nagachika <ko1@a...>
Date: Fri, 13 Sep 2013 00:29:08 +0900 (JST)
Subject: [ruby-changes:30843] nagachika:r42922 (ruby_2_0_0): merge revision(s) 42450: [Backport #8735]
nagachika 2013-09-13 00:28:56 +0900 (Fri, 13 Sep 2013) New Revision: 42922 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42922 Log: merge revision(s) 42450: [Backport #8735] * enumerator.c (lazy_zip_func): fix non-single argument. fix out-of-bound access and pack multiple yielded values. [ruby-core:56383] [Bug #8735] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/enumerator.c branches/ruby_2_0_0/test/ruby/test_lazy_enumerator.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 42921) +++ ruby_2_0_0/ChangeLog (revision 42922) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Sep 13 00:18:55 2013 Nobuyoshi Nakada <nobu@r...> + + * enumerator.c (lazy_zip_func): fix non-single argument. fix + out-of-bound access and pack multiple yielded values. + [ruby-core:56383] [Bug #8735] + Thu Sep 12 01:44:01 2013 Nobuyoshi Nakada <nobu@r...> * string.c (str_gsub): use BEG(0) for whole matched position not Index: ruby_2_0_0/enumerator.c =================================================================== --- ruby_2_0_0/enumerator.c (revision 42921) +++ ruby_2_0_0/enumerator.c (revision 42922) @@ -1661,7 +1661,12 @@ lazy_zip_func(VALUE val, VALUE zip_args, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/enumerator.c#L1661 } ary = rb_ary_new2(RARRAY_LEN(arg) + 1); - rb_ary_push(ary, argv[1]); + v = Qnil; + if (--argc > 0) { + ++argv; + v = argc > 1 ? rb_ary_new4(argc, argv) : *argv; + } + rb_ary_push(ary, v); for (i = 0; i < RARRAY_LEN(arg); i++) { v = rb_rescue2(call_next, RARRAY_PTR(arg)[i], next_stopped, 0, rb_eStopIteration, (VALUE)0); Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 42921) +++ ruby_2_0_0/version.h (revision 42922) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-09-12" -#define RUBY_PATCHLEVEL 304 +#define RUBY_RELEASE_DATE "2013-09-13" +#define RUBY_PATCHLEVEL 305 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 12 +#define RUBY_RELEASE_DAY 13 #include "ruby/version.h" Index: ruby_2_0_0/test/ruby/test_lazy_enumerator.rb =================================================================== --- ruby_2_0_0/test/ruby/test_lazy_enumerator.rb (revision 42921) +++ ruby_2_0_0/test/ruby/test_lazy_enumerator.rb (revision 42922) @@ -292,6 +292,18 @@ class TestLazyEnumerator < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_lazy_enumerator.rb#L292 assert_equal [[1, 42], [2, :foo]], zip.force end + def test_zip_nonsingle + bug8735 = '[ruby-core:56383] [Bug #8735]' + + obj = Object.new + def obj.each + yield + yield 1, 2 + end + + assert_equal(obj.to_enum.zip(obj.to_enum), obj.to_enum.lazy.zip(obj.to_enum).force, bug8735) + end + def test_take_rewound bug7696 = '[ruby-core:51470]' e=(1..42).lazy.take(2) Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r42450 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/