mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c (rb_ary_product): Make defensive copy in case of block...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d0a98a0e90
commit
94ab139bc9
1 changed files with 5 additions and 1 deletions
6
array.c
6
array.c
|
@ -4103,7 +4103,11 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
|
|||
}
|
||||
|
||||
/* 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++) {
|
||||
|
|
Loading…
Reference in a new issue