diff options
-rw-r--r-- | sv.c | 3 | ||||
-rw-r--r-- | t/op/method.t | 2 |
2 files changed, 3 insertions, 2 deletions
@@ -6776,6 +6776,7 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) { if (HvNAME(stash)) { CV* destructor = NULL; struct mro_meta *meta; + assert (SvOOK(stash)); DEBUG_o( Perl_deb(aTHX_ "Looking for DESTROY method for %s\n", @@ -6791,7 +6792,7 @@ S_curse(pTHX_ SV * const sv, const bool check_refcnt) { } else { GV * const gv = - gv_fetchmeth_autoload(stash, "DESTROY", 7, 0); + gv_fetchmethod_pvn_flags(stash, "DESTROY", 7, GV_AUTOLOAD); if (gv) destructor = GvCV(gv); meta->destroy_gen = PL_sub_generation; meta->destroy = destructor; diff --git a/t/op/method.t b/t/op/method.t index bdac5bbcc3..d11a7038c3 100644 --- a/t/op/method.t +++ b/t/op/method.t @@ -361,6 +361,7 @@ for my $meth (['Bar', 'Foo::Bar'], { fresh_perl_is(<<EOT, package UNIVERSAL; sub AUTOLOAD { my \$c = shift; print "\$c \$AUTOLOAD\\n" } +sub DESTROY {} # prevent AUTOLOAD being called on DESTROY package Xyz; package main; Foo->$meth->[0](); EOT @@ -462,7 +463,6 @@ is $kalled, 1, 'calling a class method via a magic variable'; { # [perl #124387] - local $::TODO = "AUTOLOAD not being called for DESTROY"; my $autoloaded; package AutoloadDestroy; sub AUTOLOAD { $autoloaded = 1 } |