From: Father Chrysostomos Date: Wed, 28 Nov 2012 20:39:04 +0000 (-0800) Subject: Don’t croak for local *DetachedStash::method X-Git-Tag: upstream/5.20.0~4646^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=959f7ad7c12f768f896b4dd48b5b7f41b6b087b5;p=platform%2Fupstream%2Fperl.git Don’t croak for local *DetachedStash::method save_gp was trying to call mro_method_changed_in even if the stash had been detached. This is a regression from 5.12. --- diff --git a/scope.c b/scope.c index 8eca725..c4a2222 100644 --- a/scope.c +++ b/scope.c @@ -285,8 +285,9 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) 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(); diff --git a/t/mro/basic.t b/t/mro/basic.t index 10aa44c..cc1386c 100644 --- a/t/mro/basic.t +++ b/t/mro/basic.t @@ -3,7 +3,7 @@ use strict; use warnings; -BEGIN { require q(./test.pl); } plan(tests => 54); +BEGIN { require q(./test.pl); } plan(tests => 55); require mro; @@ -346,3 +346,10 @@ is(eval { MRO_N->testfunc() }, 123); @{*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'; +}