Bug #1028

Array#zip cannot accept enumerables as arguments.

Added by Usaku NAKAMURA over 5 years ago. Updated almost 3 years ago.

[ruby-dev:37797]
Status:Closed
Priority:Low
Assignee:-
Category:-
Target version:-
ruby -v: Backport:

Description

=begin
こんにちは、なかむら(う)です。

In message " Ruby:r21678 (trunk): * array.c (takeitems), enum.c (enumzip): tries to convert to"
on Jan.20,2009 06:47:50, nobu@ruby-lang.org wrote:

nobu 2009-01-20 06:47:48 +0900 (Tue, 20 Jan 2009)

New Revision: 21678

http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21678

Log:
* array.c (takeitems), enum.c (enumzip): tries to convert to
array first.

たぶん、arrayへの変換を試し、ダメならeachで回す、というのが意
図だろうと思うのですが、Enumerable#zipは大丈夫ですがArray#zip
がそうなっていません。

Index: array.c
===================================================================
--- array.c (revision 21699)
+++ array.c (working copy)
@@ -2209,7 +2209,7 @@ takei(VALUE val, VALUE *args, int argc,
static VALUE
take
items(VALUE obj, long n)
{
- VALUE result = toary(obj);
+ VALUE result = rb
checkarraytype(obj);
VALUE args[2];

  if (!NIL_P(result)) return rb_ary_subseq(result, 0, n);

それでは。
--
U.Nakamura usa@garbagecollect.jp
=end

History

#1 Updated by Usaku NAKAMURA over 5 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r21713.
=end

Also available in: Atom PDF