Project

General

Profile

Backport #8735

Enumerator::Lazy#zip behaves differently from Enumerable#zip when yield with non-single argument

Added by kachick (Kenichi Kamiya) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:56383]

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

Associated revisions

Revision 8d644d6a
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision 42450
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

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]

Revision ba76a79a
Added by nagachika (Tomoyuki Chikanaga) almost 6 years ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 42922
Added by nagachika (Tomoyuki Chikanaga) almost 6 years ago

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]

History

Updated by nobu (Nobuyoshi Nakada) almost 6 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED
#2

Updated by nobu (Nobuyoshi Nakada) almost 6 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 phluid61 (Matthew Kerwin) almost 6 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/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/

#5

Updated by nagachika (Tomoyuki Chikanaga) almost 6 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)
#6

Updated by nagachika (Tomoyuki Chikanaga) almost 6 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]

Also available in: Atom PDF