Do not have Enumeratory::Lazy#zip mark result as packed

Fixes [Bug #19569]
This commit is contained in:
Jeremy Evans 2023-06-21 09:44:30 -07:00
parent c94b5f121d
commit a14915ca4b
Notes: git 2023-06-24 15:41:51 +00:00
2 changed files with 5 additions and 1 deletions

View File

@ -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;
}

View File

@ -282,6 +282,11 @@ class TestLazyEnumerator < Test::Unit::TestCase
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)