Skip to content

Commit

Permalink
Do not have Enumeratory::Lazy#zip mark result as packed
Browse files Browse the repository at this point in the history
Fixes [Bug #19569]
  • Loading branch information
jeremyevans committed Jun 24, 2023
1 parent c94b5f1 commit a14915c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion enumerator.c
Expand Up @@ -2369,7 +2369,6 @@ lazy_zip_arrays_func(VALUE proc_entry, struct MEMO *result, VALUE memos, long me
rb_ary_push(ary, rb_ary_entry(RARRAY_AREF(arrays, i), count));
}
LAZY_MEMO_SET_VALUE(result, ary);
LAZY_MEMO_SET_PACKED(result);
rb_ary_store(memos, memo_index, LONG2NUM(++count));
return result;
}
Expand Down
5 changes: 5 additions & 0 deletions test/ruby/test_lazy_enumerator.rb
Expand Up @@ -282,6 +282,11 @@ def test_zip_with_block
assert_equal(3, a.current)
end

def test_zip_map_lambda_bug_19569
ary = [1, 2, 3].to_enum.lazy.zip([:a, :b, :c]).map(&:last).to_a
assert_equal([:a, :b, :c], ary)
end

def test_take
a = Step.new(1..10)
assert_equal(1, a.take(5).first)
Expand Down

0 comments on commit a14915c

Please sign in to comment.