From: Matthew Kerwin Date: 2013-08-08T17:42:26+10:00 Subject: [ruby-core:56451] Re: [ruby-trunk - Bug #8735][Open] Enumerator::Lazy#zip behaves differently from Enumerable#zip when yield with non-single argument --047d7b86f846a4f6ee04e36acc70 Content-Type: text/plain; charset=ISO-8859-1 I believe the issue is here: https://github.com/ruby/ruby/blob/trunk/enumerator.c#L1703 I'd write a patch for the cases argc==0{Qnil} or argc>1{rb_ary_new4(...)} but I'm away from my computer right now. Sent from my phone, so excuse the typos. On Aug 5, 2013 9:30 PM, "kachick (Kenichi Kamiya)" wrote: > > Issue #8735 has been reported by kachick (Kenichi Kamiya). > > ---------------------------------------- > Bug #8735: Enumerator::Lazy#zip behaves differently from Enumerable#zip > when yield with non-single argument > https://bugs.ruby-lang.org/issues/8735 > > Author: kachick (Kenichi Kamiya) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > ruby -v: ruby -v ruby 2.1.0dev (2013-08-05 trunk 42385) [i686-linux] > Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN > > > =begin > Is this intended? > > > obj = Object.new > def obj.each > yield > yield 1, 2 > end > > obj.to_enum.zip(obj.to_enum) #=> [[nil, nil], > # [[1, 2], [1, 2]]] > > > obj.to_enum.lazy.zip(obj.to_enum).force #=> [[false, nil], > # [1, [1, 2]]] > =end > > > > -- > http://bugs.ruby-lang.org/ > > --047d7b86f846a4f6ee04e36acc70 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

I believe the issue is here: https://github.com/ruby/ruby/blob/trunk/enumera= tor.c#L1703

I'd write a patch for the cases argc=3D=3D0{Qnil} or argc>1{rb_ar= y_new4(...)} but I'm away from my computer right now.

Sent from my phone, so excuse the typos.

On Aug 5, 2013 9:30 PM, "kachick (Kenichi K= amiya)" <kachick1@gmail.com> wrote:

Issue #8735 has been reported by kachick (Kenichi Kamiya).

----------------------------------------
Bug #8735: Enumerator::Lazy#zip behaves differently from Enumerable#zip whe= n yield with non-single argument
https:= //bugs.ruby-lang.org/issues/8735

Author: kachick (Kenichi Kamiya)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby -v ruby 2.1.0dev (2013-08-05 trunk 42385) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


=3Dbegin
Is this intended?


=A0obj =3D Object.new
=A0def obj.each
=A0 =A0yield
=A0 =A0yield 1, 2
=A0end

=A0obj.to_enum.zip(obj.to_enum) =A0 =A0 =A0 =A0 =A0 =A0#=3D> [[nil, nil]= ,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0# =A0 =A0[[1, 2], [1, 2]]]


=A0obj.to_enum.lazy.zip(obj.to_enum).force #=3D> [[false, nil],
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0# =A0 =A0[1, [1, 2]]]
=3Dend



--
http://bugs.ruby-l= ang.org/

--047d7b86f846a4f6ee04e36acc70--