Backport #8735
closedEnumerator::Lazy#zip behaves differently from Enumerable#zip when yield with non-single argument
Description
=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
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r42450.
Kenichi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
enumerator.c: fix non-single argument
- enumerator.c (lazy_zip_func): fix non-single argument. fix
out-of-bound access and pack multiple yielded values.
[ruby-core:56383] [Bug #8735]
Updated by kachick (Kenichi Kamiya) over 10 years ago
Thank you!
Updated by phluid61 (Matthew Kerwin) over 10 years ago
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)" kachick1@gmail.com
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/8735Author: 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
endobj.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
Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago
- Tracker changed from Bug to Backport
- Project changed from Ruby master to Backport200
- Status changed from Closed to Assigned
- Assignee set to nagachika (Tomoyuki Chikanaga)
Updated by nagachika (Tomoyuki Chikanaga) over 10 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r42922.
Kenichi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
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]