save_gp was trying to call mro_method_changed_in even if the stash had
been detached.
This is a regression from 5.12.
if (empty) {
GP *gp = Perl_newGP(aTHX_ gv);
+ HV * const stash = GvSTASH(gv);
- if (GvCVu(gv))
+ if (GvCVu(gv) && stash && HvENAME(stash))
mro_method_changed_in(GvSTASH(gv)); /* taking a method out of circulation ("local")*/
if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
gp->gp_io = newIO();
use strict;
use warnings;
-BEGIN { require q(./test.pl); } plan(tests => 54);
+BEGIN { require q(./test.pl); } plan(tests => 55);
require mro;
@{*fednu::ISA} = "pyfg";
ok +fednu->isa("pyfg"), 'autovivifying @ISA via *{@ISA}';
}
+
+{
+ sub Detached::method;
+ my $h = delete $::{"Detached::"};
+ eval { local *Detached::method };
+ is $@, "", 'localising gv-with-cv belonging to detached package';
+}