From a14915ca4baae40f08d288a38b8bfb595500ad90 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 21 Jun 2023 09:44:30 -0700 Subject: [PATCH] Do not have Enumeratory::Lazy#zip mark result as packed Fixes [Bug #19569] --- enumerator.c | 1 - test/ruby/test_lazy_enumerator.rb | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/enumerator.c b/enumerator.c index b33c171371..1058e331bb 100644 --- a/enumerator.c +++ b/enumerator.c @@ -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; } diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 32bf097318..22127e903a 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -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)