This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Delay @ISA magic while unshifting
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Fri, 18 Sep 2015 16:40:01 +0000 (17:40 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 18 Oct 2015 11:04:27 +0000 (12:04 +0100)
commit395391414ee1260c2b34a5f6a353908cc9d48d3f
tree9e8d4baaf15db0bc4e9fb35bd72e0d8801b19ad3
parentbdae4172ce49ee233037d3e6af7dbeea521d0562
Delay @ISA magic while unshifting

pp_unshift() first calls av_unshift(), which prepends the the
requisite number of undefs, then calls av_store() for each item.
However, unlike pp_push() it was not setting PL_delaymagic around the
av_store() loop, so when unshifting onto @ISA, its magic would be
triggered while there were still undefs in the array, causig the
following spurious warning:

    $ perl -wE 'package Foo; unshift @ISA, qw(A B)'
    Use of uninitialized value in unshift at -e line 1.

Also fix pp_push() to save and restore PL_delaymagic instead of
clearing it, so that e.g. unshifting a tied value with FETCH pushing
onto another @ISA doesn't erroneously clear the value from underneath
the unshift.
pp.c
t/op/magic.t