In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/0f3591f94499f7771d7a8e07afb6776a93fc5f9f?hp=ef7498d2b69936a5c6476ecf1950066f638b2dac>
- Log ----------------------------------------------------------------- commit 0f3591f94499f7771d7a8e07afb6776a93fc5f9f Author: Father Chrysostomos <spr...@cpan.org> Date: Sun Jan 21 16:19:56 2018 -0800 Follow-up to fd77b29b3be4 As Zefram pointed out, I left in a piece of code that caused one branch to continue to behave as before. The change was ineffective and the tests happened to be written in such a way as to take the other branch. ----------------------------------------------------------------------- Summary of changes: pp_hot.c | 2 -- t/op/array.t | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pp_hot.c b/pp_hot.c index 1bc453a457..1b9fb9427a 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1175,8 +1175,6 @@ S_pushav(pTHX_ AV* const av) PADOFFSET i; for (i=0; i < (PADOFFSET)maxarg; i++) { SV *sv = AvARRAY(av)[i]; - if (!LIKELY(sv)) - AvARRAY(av)[i] = sv = newSV(0); SP[i+1] = LIKELY(sv) ? sv : UNLIKELY(PL_op->op_flags & OPf_MOD) diff --git a/t/op/array.t b/t/op/array.t index 9d0bfad4ef..aa595327bc 100644 --- a/t/op/array.t +++ b/t/op/array.t @@ -6,7 +6,7 @@ BEGIN { set_up_inc('.', '../lib'); } -plan (185); +plan (188); # # @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them @@ -623,6 +623,22 @@ $#a = -1; $#a++; 'map {} @a does not vivify elements'; $#a = -1; {local $a[3] = 12; my @foo=@a}; + is @a, 0,'unwinding localization of elem past end of array shrinks it'; +} +{ + # Again, but with a non-magical array ($#a makes it magical) + my @a = 1; + delete $a[0]; + my @b = @a; + ok !exists $a[0], 'copying an array via = does not vivify elements'; + delete $a[0]; + @a[1..5] = 1..5; + my $count; + my @existing_elements = map { exists $a[$count++] ? $_ : () } @a; + is join(",", @existing_elements), "1,2,3,4,5", + 'map {} @a does not vivify elements'; + @a = (); + {local $a[3] = 12; my @foo=@a}; is @a, 0, 'unwinding localization of elem past end of array shrinks it' } -- Perl5 Master Repository