ruby-changes:15315
From: marcandre <ko1@a...>
Date: Sat, 3 Apr 2010 07:44:31 +0900 (JST)
Subject: [ruby-changes:15315] Ruby:r27202 (trunk): * array.c (rb_ary_product): Make defensive copy in case of block...
marcandre 2010-04-03 07:44:17 +0900 (Sat, 03 Apr 2010) New Revision: 27202 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27202 Log: * array.c (rb_ary_product): Make defensive copy in case of block... Modified files: trunk/array.c Index: array.c =================================================================== --- array.c (revision 27201) +++ array.c (revision 27202) @@ -4103,7 +4103,11 @@ } /* Otherwise, allocate and fill in an array of results */ - if (!rb_block_given_p()) { + if (rb_block_given_p()) { + /* Make defensive copies of arrays */ + for (i = 0; i < n; i++) arrays[i] = ary_make_substitution(arrays[i]); + } + else { result = rb_ary_new2(resultlen); } for (i = 0; i < resultlen; i++) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/